[GnomeMeeting-devel-list] Patch to use the new file selector
- From: Miguel Rodríguez Pérez <migrax terra es>
- To: gnomemeeting-devel-list gnome org
- Subject: [GnomeMeeting-devel-list] Patch to use the new file selector
- Date: Mon, 29 Mar 2004 19:40:55 +0200
Just wanted to mail it here so that it doesn't get lost before
gnomemeeting depends on gtk+2.4
I see three possibilities for when to commit it:
a) Right now to both branch (gnome-2-6 and HEAD).
b) Right now to HEAD
c) Later to HEAD.
I think there is no problem going on with b)... (I myself good like to
see a), but i know lots of people will protest if they are forced to
upgrade their gtk+ only for using the the file-selector (basically, our
kde users)).
What do you think?
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gnomemeeting/ChangeLog,v
retrieving revision 1.1213
diff -d -u -r1.1213 ChangeLog
--- ChangeLog 27 Mar 2004 21:14:48 -0000 1.1213
+++ ChangeLog 29 Mar 2004 17:36:04 -0000
@@ -1,3 +1,10 @@
+2004-03-29 Miguel Rodr�ez P�z <migrax terra es>
+
+ * configure.in: Request gtk+2.4.
+
+ * src/pref_window.cpp (browse_button_clicked_cb): Use new file
+ selector widget.
+
2004-03-27 Damien Sandras <dsandras seconix com>
* lib/gm_conf-gconf.c, lib/gm_conf-glib.c,
Index: src/pref_window.cpp
===================================================================
RCS file: /cvs/gnome/gnomemeeting/src/pref_window.cpp,v
retrieving revision 1.215
diff -d -u -r1.215 pref_window.cpp
--- src/pref_window.cpp 27 Mar 2004 18:34:51 -0000 1.215
+++ src/pref_window.cpp 29 Mar 2004 17:36:06 -0000
@@ -103,9 +103,6 @@
static void browse_button_clicked_cb (GtkWidget *,
gpointer);
-static void file_selector_clicked (GtkFileSelection *,
- gpointer);
-
static void gnomemeeting_init_pref_window_general (GtkWidget *,
GtkWidget *);
@@ -375,27 +372,6 @@
}
-/* DESCRIPTION : This callback is called when the user clicks
- * on a button of the file selector.
- * BEHAVIOR : It sets the selected filename in the good entry (given
- * as data of the object because of the bad API). Emits the
- * focus-out-event to simulate it.
- * PRE : data = the file selector.
- */
-static void
-file_selector_clicked (GtkFileSelection *b, gpointer data)
-{
- gchar *filename = NULL;
-
- filename =
- (gchar *) gtk_file_selection_get_filename (GTK_FILE_SELECTION (data));
-
- gtk_entry_set_text (GTK_ENTRY (g_object_get_data (G_OBJECT (data), "entry")),
- filename);
-
- g_signal_emit_by_name (G_OBJECT (g_object_get_data (G_OBJECT (data), "entry")), "activate");
-}
-
/* DESCRIPTION : This callback is called when the user clicks
* on the browse button (in the video devices or sound events).
@@ -407,29 +383,26 @@
{
GtkWidget *selector = NULL;
- selector = gtk_file_selection_new (_("Choose a Picture"));
+ selector = gtk_file_chooser_dialog_new (_("Choose a Picture"),
+ GTK_WINDOW (gtk_widget_get_toplevel (b)),
+ GTK_FILE_CHOOSER_ACTION_OPEN,
+ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+ GTK_STOCK_OPEN,
+ GTK_RESPONSE_ACCEPT,
+ NULL);
+
+ if (gtk_dialog_run (GTK_DIALOG (selector)) == GTK_RESPONSE_ACCEPT)
+ {
+ char *filename;
- gtk_widget_show (selector);
+ filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (selector));
+ gtk_entry_set_text (GTK_ENTRY (data), filename);
+ g_free (filename);
- /* FIX ME: Ugly hack cause the file selector API is not good and I don't
- want to use global variables */
- g_object_set_data (G_OBJECT (selector), "entry", (gpointer) data);
-
- g_signal_connect (G_OBJECT (GTK_FILE_SELECTION (selector)->ok_button),
- "clicked",
- G_CALLBACK (file_selector_clicked),
- (gpointer) selector);
-
- /* Ensure that the dialog box is destroyed when the user clicks a button. */
- g_signal_connect_swapped (G_OBJECT (GTK_FILE_SELECTION (selector)->ok_button),
- "clicked",
- G_CALLBACK (gtk_widget_destroy),
- (gpointer) selector);
+ g_signal_emit_by_name (G_OBJECT (data), "activate");
+ }
- g_signal_connect_swapped (G_OBJECT (GTK_FILE_SELECTION (selector)->cancel_button),
- "clicked",
- G_CALLBACK (gtk_widget_destroy),
- (gpointer) selector);
+ gtk_widget_destroy (selector);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]