mirror of
https://gitlab.gnome.org/GNOME/eog
synced 2024-10-18 14:04:27 +00:00
move the file chooser helpers to the shell where they belong. Rename
eog-file-selctor to eog-file-chooser while at it and update the other files for this change.
This commit is contained in:
parent
fe5080c95b
commit
614f5ed1b3
|
@ -1,3 +1,8 @@
|
|||
2005-07-15 Paolo Borelli <pborelli@katamail.com>
|
||||
|
||||
* move the eog-file-chooser and the save dialog helpers from
|
||||
libeog to the shell, since they are specific to the eog app.
|
||||
|
||||
2005-07-14 Philip Van Hoof <pvanhoof@gnome.org>
|
||||
|
||||
* configure.in, libeog/eog-image.c, libeog/eog-image.h,
|
||||
|
|
|
@ -39,8 +39,6 @@ libeog_a_SOURCES = \
|
|||
accessible-image-view-factory.c \
|
||||
accessible-image-view.h \
|
||||
accessible-image-view.c \
|
||||
eog-file-selection.h \
|
||||
eog-file-selection.c \
|
||||
eog-full-screen.h \
|
||||
eog-full-screen.c \
|
||||
eog-pixbuf-util.h \
|
||||
|
@ -56,10 +54,6 @@ libeog_a_SOURCES = \
|
|||
eog-image-save-info.h \
|
||||
eog-thumbnail.h \
|
||||
eog-thumbnail.c \
|
||||
eog-save-dialog-helper.h \
|
||||
eog-save-dialog-helper.c \
|
||||
eog-save-as-dialog-helper.h \
|
||||
eog-save-as-dialog-helper.c \
|
||||
eog-image-cache.h \
|
||||
eog-image-cache.c \
|
||||
eog-image-list.c \
|
||||
|
|
|
@ -1,41 +0,0 @@
|
|||
#ifndef _EOG_FILE_SELECTION_H_
|
||||
#define _EOG_FILE_SELECTION_H_
|
||||
|
||||
#include <gtk/gtkfilechooserdialog.h>
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define EOG_TYPE_FILE_SELECTION (eog_file_selection_get_type ())
|
||||
#define EOG_FILE_SELECTION(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EOG_TYPE_FILE_SELECTION, EogFileSelection))
|
||||
#define EOG_FILE_SELECTION_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), EOG_TYPE_FILE_SELECTION, EogFileSelectionClass))
|
||||
|
||||
#define EOG_IS_FILE_SELECTION(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EOG_TYPE_FILE_SELECTION))
|
||||
#define EOG_IS_FILE_SELECTION_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EOG_TYPE_FILE_SELECTION))
|
||||
#define EOG_FILE_SELECTION_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EOG_TYPE_FILE_SELECTION, EogFileSelectionClass))
|
||||
|
||||
typedef struct _EogFileSelection EogFileSelection;
|
||||
typedef struct _EogFileSelectionClass EogFileSelectionClass;
|
||||
typedef struct _EogFileSelectionPrivate EogFileSelectionPrivate;
|
||||
|
||||
struct _EogFileSelection {
|
||||
GtkFileChooserDialog parent_object;
|
||||
|
||||
EogFileSelectionPrivate *priv;
|
||||
};
|
||||
|
||||
|
||||
struct _EogFileSelectionClass {
|
||||
GtkFileChooserDialogClass parent_object;
|
||||
};
|
||||
|
||||
|
||||
GtkType eog_file_selection_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GtkWidget* eog_file_selection_new (GtkFileChooserAction action);
|
||||
|
||||
GdkPixbufFormat* eog_file_selection_get_format (EogFileSelection *sel);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* _EOG_FILE_SELECTION_H_ */
|
|
@ -4,18 +4,19 @@
|
|||
eog.desktop.in.in
|
||||
eog.glade
|
||||
eog.schemas.in
|
||||
libeog/eog-file-selection.c
|
||||
libeog/eog-image-jpeg.c
|
||||
libeog/eog-image.c
|
||||
libeog/eog-info-view-exif.c
|
||||
libeog/eog-info-view-file.c
|
||||
libeog/eog-info-view.c
|
||||
libeog/eog-save-as-dialog-helper.c
|
||||
libeog/eog-save-dialog-helper.c
|
||||
libeog/eog-uri-converter.c
|
||||
libeog/eog-uri-converter.h
|
||||
libeog/eog-util.c
|
||||
shell/eog-file-chooser.c
|
||||
shell/eog-preferences.c
|
||||
shell/eog-save-as-dialog-helper.c
|
||||
shell/eog-save-dialog-helper.c
|
||||
shell/eog-statusbar.c
|
||||
shell/eog-window.c
|
||||
shell/main.c
|
||||
shell/util.c
|
||||
libeog/eog-util.c
|
||||
shell/eog-preferences.c
|
||||
|
|
|
@ -6,7 +6,7 @@ jpeg_DEPS = $(top_builddir)/jpegutils/libeog-jpegutils.a
|
|||
endif
|
||||
|
||||
INCLUDES = \
|
||||
-DGNOMELOCALEDIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \
|
||||
-DGNOMELOCALEDIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \
|
||||
-I$(top_srcdir)/libeog \
|
||||
-I$(top_builddir)/libeog \
|
||||
-I$(top_srcdir)/shell/recent-files \
|
||||
|
@ -19,17 +19,23 @@ INCLUDES = \
|
|||
|
||||
bin_PROGRAMS = eog
|
||||
|
||||
eog_SOURCES = \
|
||||
eog-window.h \
|
||||
eog-window.c \
|
||||
eog-preferences.h \
|
||||
eog-preferences.c \
|
||||
eog-statusbar.h \
|
||||
eog-statusbar.c \
|
||||
main.c \
|
||||
session.c \
|
||||
session.h \
|
||||
util.h \
|
||||
eog_SOURCES = \
|
||||
eog-window.h \
|
||||
eog-window.c \
|
||||
eog-preferences.h \
|
||||
eog-preferences.c \
|
||||
eog-file-chooser.h \
|
||||
eog-file-chooser.c \
|
||||
eog-save-dialog-helper.h \
|
||||
eog-save-dialog-helper.c \
|
||||
eog-save-as-dialog-helper.h \
|
||||
eog-save-as-dialog-helper.c \
|
||||
eog-statusbar.h \
|
||||
eog-statusbar.c \
|
||||
main.c \
|
||||
session.c \
|
||||
session.h \
|
||||
util.h \
|
||||
util.c
|
||||
|
||||
eog_DEPENDENCIES = \
|
||||
|
|
|
@ -1,6 +1,23 @@
|
|||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "eog-file-selection.h"
|
||||
#include <libgnome/gnome-macros.h>
|
||||
#include <glib/gi18n.h>
|
||||
#include <glib/gslist.h>
|
||||
|
@ -20,12 +37,18 @@
|
|||
#include "eog-config-keys.h"
|
||||
#include "eog-pixbuf-util.h"
|
||||
|
||||
static char* last_dir[] = { NULL, NULL, NULL, NULL };
|
||||
#include "eog-file-chooser.h"
|
||||
|
||||
static char *last_dir[] = { NULL, NULL, NULL, NULL };
|
||||
|
||||
#define FILE_FORMAT_KEY "file-format"
|
||||
|
||||
#define EOG_FILE_CHOOSER_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), \
|
||||
EOG_TYPE_FILE_CHOOSER, \
|
||||
EogFileChooserPrivate))
|
||||
|
||||
struct _EogFileSelectionPrivate {
|
||||
struct _EogFileChooserPrivate
|
||||
{
|
||||
GnomeThumbnailFactory *thumb_factory;
|
||||
|
||||
GtkWidget *image;
|
||||
|
@ -34,55 +57,35 @@ struct _EogFileSelectionPrivate {
|
|||
GtkWidget *creator_label;
|
||||
};
|
||||
|
||||
GNOME_CLASS_BOILERPLATE (EogFileSelection,
|
||||
eog_file_selection,
|
||||
GtkFileChooserDialog,
|
||||
GTK_TYPE_FILE_CHOOSER_DIALOG);
|
||||
G_DEFINE_TYPE(EogFileChooser, eog_file_chooser, GTK_TYPE_FILE_CHOOSER_DIALOG)
|
||||
|
||||
static void
|
||||
eog_file_selection_dispose (GObject *object)
|
||||
eog_file_chooser_finalize (GObject *object)
|
||||
{
|
||||
EogFileSelectionPrivate *priv;
|
||||
EogFileChooserPrivate *priv;
|
||||
|
||||
priv = EOG_FILE_SELECTION (object)->priv;
|
||||
priv = EOG_FILE_CHOOSER (object)->priv;
|
||||
|
||||
if (priv->thumb_factory != NULL) {
|
||||
if (priv->thumb_factory != NULL)
|
||||
g_object_unref (priv->thumb_factory);
|
||||
priv->thumb_factory = NULL;
|
||||
}
|
||||
|
||||
GNOME_CALL_PARENT (G_OBJECT_CLASS, dispose, (object));
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
eog_file_selection_finalize (GObject *object)
|
||||
{
|
||||
EogFileSelectionPrivate *priv;
|
||||
|
||||
priv = EOG_FILE_SELECTION (object)->priv;
|
||||
|
||||
g_free (priv);
|
||||
|
||||
GNOME_CALL_PARENT (G_OBJECT_CLASS, finalize, (object));
|
||||
(* G_OBJECT_CLASS (eog_file_chooser_parent_class)->finalize) (object);
|
||||
}
|
||||
|
||||
static void
|
||||
eog_file_selection_class_init (EogFileSelectionClass *klass)
|
||||
eog_file_chooser_class_init (EogFileChooserClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = (GObjectClass*) klass;
|
||||
GObjectClass *object_class = (GObjectClass *) klass;
|
||||
|
||||
object_class->dispose = eog_file_selection_dispose;
|
||||
object_class->finalize = eog_file_selection_finalize;
|
||||
object_class->finalize = eog_file_chooser_finalize;
|
||||
|
||||
g_type_class_add_private (object_class, sizeof (EogFileChooserPrivate));
|
||||
}
|
||||
|
||||
static void
|
||||
eog_file_selection_instance_init (EogFileSelection *filesel)
|
||||
eog_file_chooser_init (EogFileChooser *chooser)
|
||||
{
|
||||
EogFileSelectionPrivate *priv;
|
||||
|
||||
priv = g_new0 (EogFileSelectionPrivate, 1);
|
||||
filesel->priv = priv;
|
||||
chooser->priv = EOG_FILE_CHOOSER_GET_PRIVATE (chooser);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -94,16 +97,16 @@ response_cb (GtkDialog *dlg, gint id, gpointer data)
|
|||
if (id == GTK_RESPONSE_OK) {
|
||||
dir = gtk_file_chooser_get_current_folder (GTK_FILE_CHOOSER (dlg));
|
||||
action = gtk_file_chooser_get_action (GTK_FILE_CHOOSER (dlg));
|
||||
|
||||
|
||||
if (last_dir [action] != NULL)
|
||||
g_free (last_dir [action]);
|
||||
|
||||
|
||||
last_dir [action] = dir;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
eog_file_selection_add_filter (EogFileSelection *filesel)
|
||||
eog_file_chooser_add_filter (EogFileChooser *chooser)
|
||||
{
|
||||
GSList *it;
|
||||
GSList *formats;
|
||||
|
@ -115,7 +118,7 @@ eog_file_selection_add_filter (EogFileSelection *filesel)
|
|||
int i;
|
||||
GtkFileChooserAction action;
|
||||
|
||||
action = gtk_file_chooser_get_action (GTK_FILE_CHOOSER (filesel));
|
||||
action = gtk_file_chooser_get_action (GTK_FILE_CHOOSER (chooser));
|
||||
|
||||
if (action != GTK_FILE_CHOOSER_ACTION_SAVE && action != GTK_FILE_CHOOSER_ACTION_OPEN) {
|
||||
return;
|
||||
|
@ -173,7 +176,7 @@ eog_file_selection_add_filter (EogFileSelection *filesel)
|
|||
g_strfreev (pattern);
|
||||
|
||||
/* attach GdkPixbufFormat to filter, see also
|
||||
* eog_file_selection_get_format. */
|
||||
* eog_file_chooser_get_format. */
|
||||
g_object_set_data (G_OBJECT (filter),
|
||||
FILE_FORMAT_KEY,
|
||||
format);
|
||||
|
@ -183,12 +186,12 @@ eog_file_selection_add_filter (EogFileSelection *filesel)
|
|||
g_slist_free (formats);
|
||||
|
||||
/* Add filter to filechooser */
|
||||
gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (filesel), all_file_filter);
|
||||
gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (filesel), all_img_filter);
|
||||
gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (filesel), all_img_filter);
|
||||
gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (chooser), all_file_filter);
|
||||
gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (chooser), all_img_filter);
|
||||
gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (chooser), all_img_filter);
|
||||
|
||||
for (it = filters; it != NULL; it = it->next) {
|
||||
gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (filesel), GTK_FILE_FILTER (it->data));
|
||||
gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (chooser), GTK_FILE_FILTER (it->data));
|
||||
}
|
||||
g_slist_free (filters);
|
||||
}
|
||||
|
@ -209,9 +212,9 @@ set_preview_label (GtkWidget *label, const char *str)
|
|||
* further information according to the thumbnail spec.
|
||||
*/
|
||||
static void
|
||||
set_preview_pixbuf (EogFileSelection *filesel, GdkPixbuf *pixbuf, GnomeVFSFileInfo *info)
|
||||
set_preview_pixbuf (EogFileChooser *chooser, GdkPixbuf *pixbuf, GnomeVFSFileInfo *info)
|
||||
{
|
||||
EogFileSelectionPrivate *priv;
|
||||
EogFileChooserPrivate *priv;
|
||||
int bytes;
|
||||
int pixels;
|
||||
const char *bytes_str;
|
||||
|
@ -221,9 +224,9 @@ set_preview_pixbuf (EogFileSelection *filesel, GdkPixbuf *pixbuf, GnomeVFSFileIn
|
|||
char *size_str = NULL;
|
||||
char *dim_str = NULL;
|
||||
|
||||
g_return_if_fail (EOG_IS_FILE_SELECTION (filesel));
|
||||
g_return_if_fail (EOG_IS_FILE_CHOOSER (chooser));
|
||||
|
||||
priv = filesel->priv;
|
||||
priv = chooser->priv;
|
||||
|
||||
gtk_image_set_from_pixbuf (GTK_IMAGE (priv->image), pixbuf);
|
||||
|
||||
|
@ -279,7 +282,7 @@ set_preview_pixbuf (EogFileSelection *filesel, GdkPixbuf *pixbuf, GnomeVFSFileIn
|
|||
static void
|
||||
update_preview_cb (GtkFileChooser *file_chooser, gpointer data)
|
||||
{
|
||||
EogFileSelectionPrivate *priv;
|
||||
EogFileChooserPrivate *priv;
|
||||
char *uri;
|
||||
char *thumb_path = NULL;
|
||||
GdkPixbuf *pixbuf = NULL;
|
||||
|
@ -287,7 +290,7 @@ update_preview_cb (GtkFileChooser *file_chooser, gpointer data)
|
|||
GnomeVFSFileInfo *info;
|
||||
GnomeVFSResult result;
|
||||
|
||||
priv = EOG_FILE_SELECTION (file_chooser)->priv;
|
||||
priv = EOG_FILE_CHOOSER (file_chooser)->priv;
|
||||
|
||||
uri = gtk_file_chooser_get_preview_uri (file_chooser);
|
||||
if (uri == NULL) {
|
||||
|
@ -316,7 +319,7 @@ update_preview_cb (GtkFileChooser *file_chooser, gpointer data)
|
|||
|
||||
have_preview = (pixbuf != NULL);
|
||||
|
||||
set_preview_pixbuf (EOG_FILE_SELECTION (file_chooser), pixbuf, info);
|
||||
set_preview_pixbuf (EOG_FILE_CHOOSER (file_chooser), pixbuf, info);
|
||||
|
||||
if (pixbuf != NULL) {
|
||||
gdk_pixbuf_unref (pixbuf);
|
||||
|
@ -335,12 +338,12 @@ update_preview_cb (GtkFileChooser *file_chooser, gpointer data)
|
|||
}
|
||||
|
||||
static void
|
||||
eog_file_selection_add_preview (GtkWidget *widget)
|
||||
eog_file_chooser_add_preview (GtkWidget *widget)
|
||||
{
|
||||
EogFileSelectionPrivate *priv;
|
||||
EogFileChooserPrivate *priv;
|
||||
GtkWidget *vbox;
|
||||
|
||||
priv = EOG_FILE_SELECTION (widget)->priv;
|
||||
priv = EOG_FILE_CHOOSER (widget)->priv;
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 6);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 12);
|
||||
|
@ -353,26 +356,10 @@ eog_file_selection_add_preview (GtkWidget *widget)
|
|||
priv->size_label = gtk_label_new (NULL);
|
||||
priv->creator_label = gtk_label_new (NULL);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (vbox), priv->image,
|
||||
FALSE, /* expand */
|
||||
TRUE, /* fill */
|
||||
0 /* padding */
|
||||
);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), priv->dim_label,
|
||||
FALSE, /* expand */
|
||||
TRUE, /* fill */
|
||||
0 /* padding */
|
||||
);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), priv->size_label,
|
||||
FALSE, /* expand */
|
||||
TRUE, /* fill */
|
||||
0 /* padding */
|
||||
);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), priv->creator_label,
|
||||
FALSE, /* expand */
|
||||
TRUE, /* fill */
|
||||
0 /* padding */
|
||||
);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), priv->image, FALSE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), priv->dim_label, FALSE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), priv->size_label, FALSE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), priv->creator_label, FALSE, TRUE, 0);
|
||||
|
||||
gtk_widget_show_all (vbox);
|
||||
|
||||
|
@ -386,9 +373,9 @@ eog_file_selection_add_preview (GtkWidget *widget)
|
|||
}
|
||||
|
||||
static void
|
||||
eog_file_selection_toggle_button_cb (GtkToggleButton *button, gpointer user_data)
|
||||
eog_file_chooser_toggle_button_cb (GtkToggleButton *button, gpointer user_data)
|
||||
{
|
||||
GConfClient *client;
|
||||
GConfClient *client;
|
||||
|
||||
client = gconf_client_get_default ();
|
||||
gconf_client_set_bool (client, EOG_CONF_WINDOW_OPEN_NEW_WINDOW,
|
||||
|
@ -397,7 +384,7 @@ eog_file_selection_toggle_button_cb (GtkToggleButton *button, gpointer user_data
|
|||
}
|
||||
|
||||
static void
|
||||
eog_file_selection_add_open_new_window (GtkWidget *widget)
|
||||
eog_file_chooser_add_open_new_window (GtkWidget *widget)
|
||||
{
|
||||
GConfClient *client;
|
||||
gboolean new_window;
|
||||
|
@ -410,26 +397,28 @@ eog_file_selection_add_open_new_window (GtkWidget *widget)
|
|||
check_button = gtk_check_button_new_with_label (_("Open in new window"));
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_button), new_window);
|
||||
|
||||
g_signal_connect (G_OBJECT (check_button), "toggled",
|
||||
(GCallback) eog_file_selection_toggle_button_cb, NULL);
|
||||
g_signal_connect (check_button, "toggled",
|
||||
G_CALLBACK (eog_file_chooser_toggle_button_cb), NULL);
|
||||
|
||||
gtk_box_pack_end (GTK_BOX (GTK_DIALOG (widget)->vbox), check_button, FALSE, FALSE, 0);
|
||||
gtk_widget_show (check_button);
|
||||
}
|
||||
|
||||
GtkWidget*
|
||||
eog_file_selection_new (GtkFileChooserAction action)
|
||||
GtkWidget *
|
||||
eog_file_chooser_new (GtkFileChooserAction action)
|
||||
{
|
||||
GtkWidget *filesel;
|
||||
GtkWidget *chooser;
|
||||
gchar *title = NULL;
|
||||
|
||||
filesel = g_object_new (EOG_TYPE_FILE_SELECTION,
|
||||
chooser = g_object_new (EOG_TYPE_FILE_CHOOSER,
|
||||
"action", action,
|
||||
"select-multiple", (action == GTK_FILE_CHOOSER_ACTION_OPEN),
|
||||
"local-only", FALSE,
|
||||
NULL);
|
||||
|
||||
switch (action) {
|
||||
case GTK_FILE_CHOOSER_ACTION_OPEN:
|
||||
gtk_dialog_add_buttons (GTK_DIALOG (filesel),
|
||||
gtk_dialog_add_buttons (GTK_DIALOG (chooser),
|
||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||
GTK_STOCK_OPEN, GTK_RESPONSE_OK,
|
||||
NULL);
|
||||
|
@ -437,7 +426,7 @@ eog_file_selection_new (GtkFileChooserAction action)
|
|||
break;
|
||||
|
||||
case GTK_FILE_CHOOSER_ACTION_SAVE:
|
||||
gtk_dialog_add_buttons (GTK_DIALOG (filesel),
|
||||
gtk_dialog_add_buttons (GTK_DIALOG (chooser),
|
||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||
GTK_STOCK_SAVE, GTK_RESPONSE_OK,
|
||||
NULL);
|
||||
|
@ -445,7 +434,7 @@ eog_file_selection_new (GtkFileChooserAction action)
|
|||
break;
|
||||
|
||||
case GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER:
|
||||
gtk_dialog_add_buttons (GTK_DIALOG (filesel),
|
||||
gtk_dialog_add_buttons (GTK_DIALOG (chooser),
|
||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||
GTK_STOCK_OPEN, GTK_RESPONSE_OK,
|
||||
NULL);
|
||||
|
@ -457,37 +446,36 @@ eog_file_selection_new (GtkFileChooserAction action)
|
|||
}
|
||||
|
||||
if (action != GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER) {
|
||||
eog_file_selection_add_filter (EOG_FILE_SELECTION (filesel));
|
||||
eog_file_selection_add_preview (filesel);
|
||||
eog_file_chooser_add_filter (EOG_FILE_CHOOSER (chooser));
|
||||
eog_file_chooser_add_preview (chooser);
|
||||
}
|
||||
eog_file_selection_add_open_new_window (filesel);
|
||||
|
||||
gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (filesel), FALSE);
|
||||
eog_file_chooser_add_open_new_window (chooser);
|
||||
|
||||
if (last_dir[action] != NULL) {
|
||||
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (filesel), last_dir [action]);
|
||||
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (chooser), last_dir [action]);
|
||||
}
|
||||
|
||||
g_signal_connect (G_OBJECT (filesel), "response", G_CALLBACK (response_cb), NULL);
|
||||
gtk_window_set_title (GTK_WINDOW (filesel), title);
|
||||
gtk_dialog_set_default_response (GTK_DIALOG (filesel), GTK_RESPONSE_OK);
|
||||
g_signal_connect (chooser, "response", G_CALLBACK (response_cb), NULL);
|
||||
|
||||
return filesel;
|
||||
gtk_window_set_title (GTK_WINDOW (chooser), title);
|
||||
gtk_dialog_set_default_response (GTK_DIALOG (chooser), GTK_RESPONSE_OK);
|
||||
|
||||
return chooser;
|
||||
}
|
||||
|
||||
|
||||
GdkPixbufFormat*
|
||||
eog_file_selection_get_format (EogFileSelection *sel)
|
||||
GdkPixbufFormat *
|
||||
eog_file_chooser_get_format (EogFileChooser *chooser)
|
||||
{
|
||||
GtkFileFilter *filter;
|
||||
GdkPixbufFormat* format;
|
||||
|
||||
g_return_val_if_fail (EOG_IS_FILE_SELECTION (sel), NULL);
|
||||
g_return_val_if_fail (EOG_IS_FILE_CHOOSER (chooser), NULL);
|
||||
|
||||
filter = gtk_file_chooser_get_filter (GTK_FILE_CHOOSER (chooser));
|
||||
if (filter == NULL)
|
||||
return NULL;
|
||||
|
||||
filter = gtk_file_chooser_get_filter (GTK_FILE_CHOOSER (sel));
|
||||
if (filter == NULL) return NULL;
|
||||
|
||||
format = g_object_get_data (G_OBJECT (filter), FILE_FORMAT_KEY);
|
||||
|
||||
|
||||
return format;
|
||||
}
|
60
shell/eog-file-chooser.h
Normal file
60
shell/eog-file-chooser.h
Normal file
|
@ -0,0 +1,60 @@
|
|||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef _EOG_FILE_CHOOSER_H_
|
||||
#define _EOG_FILE_CHOOSER_H_
|
||||
|
||||
#include <gtk/gtkfilechooserdialog.h>
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define EOG_TYPE_FILE_CHOOSER (eog_file_chooser_get_type ())
|
||||
#define EOG_FILE_CHOOSER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EOG_TYPE_FILE_CHOOSER, EogFileChooser))
|
||||
#define EOG_FILE_CHOOSER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), EOG_TYPE_FILE_CHOOSER, EogFileChooserClass))
|
||||
|
||||
#define EOG_IS_FILE_CHOOSER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EOG_TYPE_FILE_CHOOSER))
|
||||
#define EOG_IS_FILE_CHOOSER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EOG_TYPE_FILE_CHOOSER))
|
||||
#define EOG_FILE_CHOOSER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EOG_TYPE_FILE_CHOOSER, EogFileChooserClass))
|
||||
|
||||
typedef struct _EogFileChooser EogFileChooser;
|
||||
typedef struct _EogFileChooserClass EogFileChooserClass;
|
||||
typedef struct _EogFileChooserPrivate EogFileChooserPrivate;
|
||||
|
||||
struct _EogFileChooser
|
||||
{
|
||||
GtkFileChooserDialog parent;
|
||||
|
||||
EogFileChooserPrivate *priv;
|
||||
};
|
||||
|
||||
struct _EogFileChooserClass
|
||||
{
|
||||
GtkFileChooserDialogClass parent_class;
|
||||
};
|
||||
|
||||
|
||||
GType eog_file_chooser_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GtkWidget *eog_file_chooser_new (GtkFileChooserAction action);
|
||||
|
||||
GdkPixbufFormat *eog_file_chooser_get_format (EogFileChooser *chooser);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* _EOG_FILE_CHOOSER_H_ */
|
|
@ -9,7 +9,7 @@
|
|||
#include <glade/glade.h>
|
||||
#include "eog-save-as-dialog-helper.h"
|
||||
#include "eog-pixbuf-util.h"
|
||||
#include "eog-file-selection.h"
|
||||
#include "eog-file-chooser.h"
|
||||
|
||||
typedef struct {
|
||||
GtkWidget *dir_entry;
|
||||
|
@ -52,7 +52,7 @@ update_preview (gpointer user_data)
|
|||
(GTK_MENU (gtk_option_menu_get_menu (GTK_OPTION_MENU (data->format_option))));
|
||||
g_assert (item != NULL);
|
||||
format = g_object_get_data (G_OBJECT (item), "format");
|
||||
|
||||
|
||||
if (token_str != NULL) {
|
||||
/* generate preview filename */
|
||||
preview_str = eog_uri_converter_preview (token_str, data->image, format,
|
||||
|
@ -85,7 +85,6 @@ request_preview_update (GtkWidget *dlg)
|
|||
data->idle_id = g_idle_add (update_preview, dlg);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
on_browse_button_clicked (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
|
@ -96,7 +95,7 @@ on_browse_button_clicked (GtkWidget *widget, gpointer data)
|
|||
sd = g_object_get_data (G_OBJECT (data), "data");
|
||||
g_assert (sd != NULL);
|
||||
|
||||
browse_dlg = eog_file_selection_new (GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
|
||||
browse_dlg = eog_file_chooser_new (GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
|
||||
|
||||
gtk_widget_show_all (browse_dlg);
|
||||
response = gtk_dialog_run (GTK_DIALOG (browse_dlg));
|
|
@ -41,7 +41,7 @@
|
|||
#include "eog-window.h"
|
||||
#include "util.h"
|
||||
#include "zoom.h"
|
||||
#include "eog-file-selection.h"
|
||||
#include "eog-file-chooser.h"
|
||||
#include "eog-preferences.h"
|
||||
#include "eog-statusbar.h"
|
||||
#include "libeog-marshal.h"
|
||||
|
@ -53,9 +53,9 @@
|
|||
#include "eog-horizontal-splitter.h"
|
||||
#include "eog-info-view.h"
|
||||
#include "eog-full-screen.h"
|
||||
#include "eog-save-dialog-helper.h"
|
||||
#include "eog-image-save-info.h"
|
||||
#include "eog-uri-converter.h"
|
||||
#include "eog-save-dialog-helper.h"
|
||||
#include "eog-save-as-dialog-helper.h"
|
||||
#include "eog-pixbuf-util.h"
|
||||
#include "eog-job-manager.h"
|
||||
|
@ -439,7 +439,7 @@ verb_FileOpen_cb (GtkAction *action, gpointer user_data)
|
|||
window = EOG_WINDOW (user_data);
|
||||
priv = window->priv;
|
||||
|
||||
dlg = eog_file_selection_new (GTK_FILE_CHOOSER_ACTION_OPEN);
|
||||
dlg = eog_file_chooser_new (GTK_FILE_CHOOSER_ACTION_OPEN);
|
||||
|
||||
gtk_widget_show_all (dlg);
|
||||
response = gtk_dialog_run (GTK_DIALOG (dlg));
|
||||
|
@ -468,7 +468,7 @@ verb_FolderOpen_cb (GtkAction *action, gpointer user_data)
|
|||
window = EOG_WINDOW (user_data);
|
||||
priv = window->priv;
|
||||
|
||||
dlg = eog_file_selection_new (GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
|
||||
dlg = eog_file_chooser_new (GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
|
||||
|
||||
gtk_widget_show_all (dlg);
|
||||
response = gtk_dialog_run (GTK_DIALOG (dlg));
|
||||
|
@ -1400,7 +1400,7 @@ save_as_uri_selection_dialog (EogWindow *window, EogImage *image, char **uri, Gd
|
|||
return;
|
||||
}
|
||||
|
||||
dlg = eog_file_selection_new (GTK_FILE_CHOOSER_ACTION_SAVE);
|
||||
dlg = eog_file_chooser_new (GTK_FILE_CHOOSER_ACTION_SAVE);
|
||||
gtk_file_chooser_set_current_folder_uri (GTK_FILE_CHOOSER (dlg),
|
||||
folder_uri);
|
||||
while (!success) {
|
||||
|
@ -1416,7 +1416,7 @@ save_as_uri_selection_dialog (EogWindow *window, EogImage *image, char **uri, Gd
|
|||
|
||||
if (response == GTK_RESPONSE_OK) {
|
||||
/* try to determine uri and image format */
|
||||
*format = eog_file_selection_get_format (EOG_FILE_SELECTION (dlg));
|
||||
*format = eog_file_chooser_get_format (EOG_FILE_CHOOSER (dlg));
|
||||
*uri = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (dlg));
|
||||
|
||||
if (*format == NULL && *uri != NULL) {
|
||||
|
@ -1653,7 +1653,7 @@ verb_Print_cb (GtkAction *action, gpointer data)
|
|||
GnomePrintConfig* config = gnome_print_config_default();
|
||||
GnomePrintContext *pc;
|
||||
GnomePrintJob *gpj = gnome_print_job_new(config);
|
||||
gint do_preview/*, copies = 1, collate = 0*/;
|
||||
gint do_preview = 0 /*, copies = 1, collate = 0*/;
|
||||
gdouble width, height;
|
||||
GnomePrintDialog *gpd = GNOME_PRINT_DIALOG (gnome_print_dialog_new(gpj,
|
||||
(const guchar*)_("Print"), GNOME_PRINT_DIALOG_COPIES));
|
||||
|
|
Loading…
Reference in a new issue