From 8019062b044e5677200168c10b64646ad8387270 Mon Sep 17 00:00:00 2001 From: arcum42 Date: Fri, 26 Dec 2008 05:12:24 +0000 Subject: [PATCH] Convert the glade file for CDVDiso to be the moderately out of date version we normally use, rather then some version out of the mists of time that Glade can't read anymore. git-svn-id: http://pcsx2-playground.googlecode.com/svn/trunk@499 a6443dda-0b58-4228-96e9-037be469359c --- plugins/CDVDiso/src/Linux/CDVDiso.glade | 771 +++++++++++++----------- plugins/CDVDiso/src/Linux/callbacks.c | 56 +- plugins/CDVDiso/src/Linux/callbacks.h | 28 +- plugins/CDVDiso/src/Linux/interface.c | 187 +++--- plugins/CDVDiso/src/Linux/support.c | 168 +++--- plugins/CDVDiso/src/Linux/support.h | 37 +- 6 files changed, 613 insertions(+), 634 deletions(-) diff --git a/plugins/CDVDiso/src/Linux/CDVDiso.glade b/plugins/CDVDiso/src/Linux/CDVDiso.glade index b5f1ce8a9c..53ab399360 100644 --- a/plugins/CDVDiso/src/Linux/CDVDiso.glade +++ b/plugins/CDVDiso/src/Linux/CDVDiso.glade @@ -1,368 +1,403 @@ - - - - - cdriso - cdriso - - - - C - False - False - False - False - False - - - - GtkWindow - Config - 5 - CDVD Config Dialog - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_CENTER - False - False - True - False - - - GtkVBox - vbox1 - 5 - False - 5 - - - GtkHBox - hbox1 - False - 10 - - 0 - True - True - - - - GtkEntry - GtkEntry_Iso - True - True - True - 0 - - - 0 - True - True - - - - - GtkButton - button5 - True - - clicked - OnFileSel - Tue, 19 Feb 2002 05:35:24 GMT - - - GTK_RELIEF_NORMAL - - 0 - False - False - - - - - - GtkHBox - hbox2 - False - 10 - - 0 - False - False - - - - GtkProgressBar - GtkProgressBar_Progress - 0 - 0 - 100 - GTK_PROGRESS_CONTINUOUS - GTK_PROGRESS_LEFT_TO_RIGHT - False - False - %P %% - 0.5 - 0.5 - - 0 - True - False - - - - - GtkButton - button6 - 61 - True - - clicked - OnStop - Tue, 19 Feb 2002 05:34:11 GMT - - - GTK_RELIEF_NORMAL - - 0 - False - False - GTK_PACK_END - - - - - - GtkHBox - hbox4 - False - 5 - - 0 - True - True - - - - GtkLabel - label2 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - 0 - False - False - - - - - GtkCombo - GtkCombo_Method - False - True - False - True - False - - - 0 - True - False - - - - GtkEntry - GtkCombo:entry - combo-entry1 - True - True - True - 0 - - - - - - - GtkHButtonBox - hbuttonbox2 - GTK_BUTTONBOX_DEFAULT_STYLE - 0 - 85 - 27 - 7 - 0 - - 0 - True - True - - - - GtkButton - GtkButton_Compress - True - True - - clicked - OnCompress - Tue, 19 Feb 2002 05:40:44 GMT - - - GTK_RELIEF_NORMAL - - - - GtkButton - GtkButton_Decompress - True - True - - clicked - OnDecompress - Tue, 19 Feb 2002 06:56:17 GMT - - - GTK_RELIEF_NORMAL - - - - - GtkHBox - hbox3 - False - 5 - - 0 - False - False - - - - GtkLabel - label1 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - 0 - False - False - - - - - GtkEntry - GtkEntry_CdDev - True - True - True - 0 - - - 0 - True - True - - - - - - GtkHButtonBox - hbuttonbox3 - GTK_BUTTONBOX_DEFAULT_STYLE - 0 - 85 - 27 - 7 - 0 - - 0 - True - True - - - - GtkButton - GtkButton_Create - True - True - - clicked - OnCreate - Tue, 19 Feb 2002 21:06:29 GMT - - - GTK_RELIEF_NORMAL - - - - GtkButton - GtkButton_CreateZ - True - True - - clicked - OnCreateZ - Tue, 19 Feb 2002 21:06:19 GMT - - - GTK_RELIEF_NORMAL - - - - - GtkHButtonBox - hbuttonbox1 - GTK_BUTTONBOX_DEFAULT_STYLE - 0 - 85 - 27 - 7 - 0 - - 0 - True - True - - - - GtkButton - button1 - True - True - - clicked - OnOk - Tue, 19 Feb 2002 05:42:17 GMT - - - GTK_RELIEF_NORMAL - - - - GtkButton - button2 - True - True - - clicked - OnCancel - Tue, 19 Feb 2002 05:42:24 GMT - - - GTK_RELIEF_NORMAL - - - - - - + + + + + + + 5 + True + CDVD Config Dialog + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + True + False + True + False + False + GDK_WINDOW_TYPE_HINT_NORMAL + GDK_GRAVITY_NORTH_WEST + True + False + + + + 5 + True + False + 5 + + + + True + False + 10 + + + + True + True + True + True + 0 + + True + * + False + + + 0 + True + True + + + + + + True + True + Select Iso + True + GTK_RELIEF_NORMAL + True + + + + 0 + False + False + + + + + 0 + True + True + + + + + + True + False + 10 + + + + True + GTK_PROGRESS_LEFT_TO_RIGHT + 0 + 0.10000000149 + PANGO_ELLIPSIZE_NONE + + + 0 + True + False + + + + + + True + True + Stop + True + GTK_RELIEF_NORMAL + True + + + + 0 + False + False + GTK_PACK_END + + + + + 0 + False + False + + + + + + True + False + 5 + + + + True + Compression Method: + False + False + GTK_JUSTIFY_CENTER + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + + True + False + True + False + True + False + + + + True + True + True + True + 0 + + True + * + False + + + + + + True + GTK_SELECTION_BROWSE + + + + True + + + + True + + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + + + + + + + 0 + True + False + + + + + 0 + True + True + + + + + + True + GTK_BUTTONBOX_DEFAULT_STYLE + 0 + + + + True + True + True + Compress Iso + True + GTK_RELIEF_NORMAL + True + + + + + + + True + True + True + Decompress Iso + True + GTK_RELIEF_NORMAL + True + + + + + + 0 + True + True + + + + + + True + False + 5 + + + + True + Cdrom Device: + False + False + GTK_JUSTIFY_CENTER + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + + True + True + True + True + 0 + + True + * + False + + + 0 + True + True + + + + + 0 + False + False + + + + + + True + GTK_BUTTONBOX_DEFAULT_STYLE + 0 + + + + True + True + True + Create Iso + True + GTK_RELIEF_NORMAL + True + + + + + + + True + True + True + Create Compressed Iso + True + GTK_RELIEF_NORMAL + True + + + + + + 0 + True + True + + + + + + True + GTK_BUTTONBOX_DEFAULT_STYLE + 0 + + + + True + True + True + gtk-ok + True + GTK_RELIEF_NORMAL + True + + + + + + + True + True + True + gtk-cancel + True + GTK_RELIEF_NORMAL + True + + + + + + 0 + True + True + + + + + + + diff --git a/plugins/CDVDiso/src/Linux/callbacks.c b/plugins/CDVDiso/src/Linux/callbacks.c index b008efe41a..14949cbbd6 100644 --- a/plugins/CDVDiso/src/Linux/callbacks.c +++ b/plugins/CDVDiso/src/Linux/callbacks.c @@ -25,14 +25,6 @@ OnStop (GtkButton *button, } -void -OnCreate (GtkButton *button, - gpointer user_data) -{ - -} - - void OnCompress (GtkButton *button, gpointer user_data) @@ -41,38 +33,6 @@ OnCompress (GtkButton *button, } -void -OnConfig_Ok (GtkButton *button, - gpointer user_data) -{ - -} - - -void -OnConfig_Cancel (GtkButton *button, - gpointer user_data) -{ - -} - - -void -OnOk (GtkButton *button, - gpointer user_data) -{ - -} - - -void -OnCancel (GtkButton *button, - gpointer user_data) -{ - -} - - void OnDecompress (GtkButton *button, gpointer user_data) @@ -96,3 +56,19 @@ OnCreateZ (GtkButton *button, } + +void +OnOk (GtkButton *button, + gpointer user_data) +{ + +} + + +void +OnCancel (GtkButton *button, + gpointer user_data) +{ + +} + diff --git a/plugins/CDVDiso/src/Linux/callbacks.h b/plugins/CDVDiso/src/Linux/callbacks.h index dfb8f733f3..956028390a 100644 --- a/plugins/CDVDiso/src/Linux/callbacks.h +++ b/plugins/CDVDiso/src/Linux/callbacks.h @@ -9,30 +9,10 @@ void OnStop (GtkButton *button, gpointer user_data); -void -OnCreate (GtkButton *button, - gpointer user_data); - void OnCompress (GtkButton *button, gpointer user_data); -void -OnConfig_Ok (GtkButton *button, - gpointer user_data); - -void -OnConfig_Cancel (GtkButton *button, - gpointer user_data); - -void -OnOk (GtkButton *button, - gpointer user_data); - -void -OnCancel (GtkButton *button, - gpointer user_data); - void OnDecompress (GtkButton *button, gpointer user_data); @@ -44,3 +24,11 @@ OnCreate (GtkButton *button, void OnCreateZ (GtkButton *button, gpointer user_data); + +void +OnOk (GtkButton *button, + gpointer user_data); + +void +OnCancel (GtkButton *button, + gpointer user_data); diff --git a/plugins/CDVDiso/src/Linux/interface.c b/plugins/CDVDiso/src/Linux/interface.c index a593b4de71..c4e95c064c 100644 --- a/plugins/CDVDiso/src/Linux/interface.c +++ b/plugins/CDVDiso/src/Linux/interface.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include @@ -18,6 +19,13 @@ #include "interface.h" #include "support.h" +#define GLADE_HOOKUP_OBJECT(component,widget,name) \ + g_object_set_data_full (G_OBJECT (component), name, \ + gtk_widget_ref (widget), (GDestroyNotify) gtk_widget_unref) + +#define GLADE_HOOKUP_OBJECT_NO_REF(component,widget,name) \ + g_object_set_data (G_OBJECT (component), name, widget) + GtkWidget* create_Config (void) { @@ -32,6 +40,7 @@ create_Config (void) GtkWidget *hbox4; GtkWidget *label2; GtkWidget *GtkCombo_Method; + GList *GtkCombo_Method_items = NULL; GtkWidget *combo_entry1; GtkWidget *hbuttonbox2; GtkWidget *GtkButton_Compress; @@ -47,206 +56,164 @@ create_Config (void) GtkWidget *button2; Config = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_object_set_data (GTK_OBJECT (Config), "Config", Config); gtk_container_set_border_width (GTK_CONTAINER (Config), 5); - gtk_window_set_title (GTK_WINDOW (Config), "CDVD Config Dialog"); - gtk_window_set_position (GTK_WINDOW (Config), GTK_WIN_POS_CENTER); + gtk_window_set_title (GTK_WINDOW (Config), _("CDVD Config Dialog")); vbox1 = gtk_vbox_new (FALSE, 5); - gtk_widget_ref (vbox1); - gtk_object_set_data_full (GTK_OBJECT (Config), "vbox1", vbox1, - (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (vbox1); gtk_container_add (GTK_CONTAINER (Config), vbox1); gtk_container_set_border_width (GTK_CONTAINER (vbox1), 5); hbox1 = gtk_hbox_new (FALSE, 10); - gtk_widget_ref (hbox1); - gtk_object_set_data_full (GTK_OBJECT (Config), "hbox1", hbox1, - (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (hbox1); gtk_box_pack_start (GTK_BOX (vbox1), hbox1, TRUE, TRUE, 0); GtkEntry_Iso = gtk_entry_new (); - gtk_widget_ref (GtkEntry_Iso); - gtk_object_set_data_full (GTK_OBJECT (Config), "GtkEntry_Iso", GtkEntry_Iso, - (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (GtkEntry_Iso); gtk_box_pack_start (GTK_BOX (hbox1), GtkEntry_Iso, TRUE, TRUE, 0); - button5 = gtk_button_new_with_label ("Select Iso"); - gtk_widget_ref (button5); - gtk_object_set_data_full (GTK_OBJECT (Config), "button5", button5, - (GtkDestroyNotify) gtk_widget_unref); + button5 = gtk_button_new_with_mnemonic (_("Select Iso")); gtk_widget_show (button5); gtk_box_pack_start (GTK_BOX (hbox1), button5, FALSE, FALSE, 0); hbox2 = gtk_hbox_new (FALSE, 10); - gtk_widget_ref (hbox2); - gtk_object_set_data_full (GTK_OBJECT (Config), "hbox2", hbox2, - (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (hbox2); gtk_box_pack_start (GTK_BOX (vbox1), hbox2, FALSE, FALSE, 0); GtkProgressBar_Progress = gtk_progress_bar_new (); - gtk_widget_ref (GtkProgressBar_Progress); - gtk_object_set_data_full (GTK_OBJECT (Config), "GtkProgressBar_Progress", GtkProgressBar_Progress, - (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (GtkProgressBar_Progress); gtk_box_pack_start (GTK_BOX (hbox2), GtkProgressBar_Progress, TRUE, FALSE, 0); - button6 = gtk_button_new_with_label ("Stop"); - gtk_widget_ref (button6); - gtk_object_set_data_full (GTK_OBJECT (Config), "button6", button6, - (GtkDestroyNotify) gtk_widget_unref); + button6 = gtk_button_new_with_mnemonic (_("Stop")); gtk_widget_show (button6); gtk_box_pack_end (GTK_BOX (hbox2), button6, FALSE, FALSE, 0); - gtk_widget_set_usize (button6, 61, -2); hbox4 = gtk_hbox_new (FALSE, 5); - gtk_widget_ref (hbox4); - gtk_object_set_data_full (GTK_OBJECT (Config), "hbox4", hbox4, - (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (hbox4); gtk_box_pack_start (GTK_BOX (vbox1), hbox4, TRUE, TRUE, 0); - label2 = gtk_label_new ("Compression Method:"); - gtk_widget_ref (label2); - gtk_object_set_data_full (GTK_OBJECT (Config), "label2", label2, - (GtkDestroyNotify) gtk_widget_unref); + label2 = gtk_label_new (_("Compression Method:")); gtk_widget_show (label2); gtk_box_pack_start (GTK_BOX (hbox4), label2, FALSE, FALSE, 0); + gtk_label_set_justify (GTK_LABEL (label2), GTK_JUSTIFY_CENTER); GtkCombo_Method = gtk_combo_new (); - gtk_widget_ref (GtkCombo_Method); - gtk_object_set_data_full (GTK_OBJECT (Config), "GtkCombo_Method", GtkCombo_Method, - (GtkDestroyNotify) gtk_widget_unref); + g_object_set_data (G_OBJECT (GTK_COMBO (GtkCombo_Method)->popwin), + "GladeParentKey", GtkCombo_Method); gtk_widget_show (GtkCombo_Method); gtk_box_pack_start (GTK_BOX (hbox4), GtkCombo_Method, TRUE, FALSE, 0); + GtkCombo_Method_items = g_list_append (GtkCombo_Method_items, (gpointer) ""); + gtk_combo_set_popdown_strings (GTK_COMBO (GtkCombo_Method), GtkCombo_Method_items); + g_list_free (GtkCombo_Method_items); combo_entry1 = GTK_COMBO (GtkCombo_Method)->entry; - gtk_widget_ref (combo_entry1); - gtk_object_set_data_full (GTK_OBJECT (Config), "combo_entry1", combo_entry1, - (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (combo_entry1); hbuttonbox2 = gtk_hbutton_box_new (); - gtk_widget_ref (hbuttonbox2); - gtk_object_set_data_full (GTK_OBJECT (Config), "hbuttonbox2", hbuttonbox2, - (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (hbuttonbox2); gtk_box_pack_start (GTK_BOX (vbox1), hbuttonbox2, TRUE, TRUE, 0); - gtk_button_box_set_spacing (GTK_BUTTON_BOX (hbuttonbox2), 0); - GtkButton_Compress = gtk_button_new_with_label ("Compress Iso"); - gtk_widget_ref (GtkButton_Compress); - gtk_object_set_data_full (GTK_OBJECT (Config), "GtkButton_Compress", GtkButton_Compress, - (GtkDestroyNotify) gtk_widget_unref); + GtkButton_Compress = gtk_button_new_with_mnemonic (_("Compress Iso")); gtk_widget_show (GtkButton_Compress); gtk_container_add (GTK_CONTAINER (hbuttonbox2), GtkButton_Compress); GTK_WIDGET_SET_FLAGS (GtkButton_Compress, GTK_CAN_DEFAULT); - GtkButton_Decompress = gtk_button_new_with_label ("Decompress Iso"); - gtk_widget_ref (GtkButton_Decompress); - gtk_object_set_data_full (GTK_OBJECT (Config), "GtkButton_Decompress", GtkButton_Decompress, - (GtkDestroyNotify) gtk_widget_unref); + GtkButton_Decompress = gtk_button_new_with_mnemonic (_("Decompress Iso")); gtk_widget_show (GtkButton_Decompress); gtk_container_add (GTK_CONTAINER (hbuttonbox2), GtkButton_Decompress); GTK_WIDGET_SET_FLAGS (GtkButton_Decompress, GTK_CAN_DEFAULT); hbox3 = gtk_hbox_new (FALSE, 5); - gtk_widget_ref (hbox3); - gtk_object_set_data_full (GTK_OBJECT (Config), "hbox3", hbox3, - (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (hbox3); gtk_box_pack_start (GTK_BOX (vbox1), hbox3, FALSE, FALSE, 0); - label1 = gtk_label_new ("Cdrom Device: "); - gtk_widget_ref (label1); - gtk_object_set_data_full (GTK_OBJECT (Config), "label1", label1, - (GtkDestroyNotify) gtk_widget_unref); + label1 = gtk_label_new (_("Cdrom Device: ")); gtk_widget_show (label1); gtk_box_pack_start (GTK_BOX (hbox3), label1, FALSE, FALSE, 0); + gtk_label_set_justify (GTK_LABEL (label1), GTK_JUSTIFY_CENTER); GtkEntry_CdDev = gtk_entry_new (); - gtk_widget_ref (GtkEntry_CdDev); - gtk_object_set_data_full (GTK_OBJECT (Config), "GtkEntry_CdDev", GtkEntry_CdDev, - (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (GtkEntry_CdDev); gtk_box_pack_start (GTK_BOX (hbox3), GtkEntry_CdDev, TRUE, TRUE, 0); hbuttonbox3 = gtk_hbutton_box_new (); - gtk_widget_ref (hbuttonbox3); - gtk_object_set_data_full (GTK_OBJECT (Config), "hbuttonbox3", hbuttonbox3, - (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (hbuttonbox3); gtk_box_pack_start (GTK_BOX (vbox1), hbuttonbox3, TRUE, TRUE, 0); - gtk_button_box_set_spacing (GTK_BUTTON_BOX (hbuttonbox3), 0); - GtkButton_Create = gtk_button_new_with_label ("Create Iso"); - gtk_widget_ref (GtkButton_Create); - gtk_object_set_data_full (GTK_OBJECT (Config), "GtkButton_Create", GtkButton_Create, - (GtkDestroyNotify) gtk_widget_unref); + GtkButton_Create = gtk_button_new_with_mnemonic (_("Create Iso")); gtk_widget_show (GtkButton_Create); gtk_container_add (GTK_CONTAINER (hbuttonbox3), GtkButton_Create); GTK_WIDGET_SET_FLAGS (GtkButton_Create, GTK_CAN_DEFAULT); - GtkButton_CreateZ = gtk_button_new_with_label ("Create Compressed Iso"); - gtk_widget_ref (GtkButton_CreateZ); - gtk_object_set_data_full (GTK_OBJECT (Config), "GtkButton_CreateZ", GtkButton_CreateZ, - (GtkDestroyNotify) gtk_widget_unref); + GtkButton_CreateZ = gtk_button_new_with_mnemonic (_("Create Compressed Iso")); gtk_widget_show (GtkButton_CreateZ); gtk_container_add (GTK_CONTAINER (hbuttonbox3), GtkButton_CreateZ); GTK_WIDGET_SET_FLAGS (GtkButton_CreateZ, GTK_CAN_DEFAULT); hbuttonbox1 = gtk_hbutton_box_new (); - gtk_widget_ref (hbuttonbox1); - gtk_object_set_data_full (GTK_OBJECT (Config), "hbuttonbox1", hbuttonbox1, - (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (hbuttonbox1); gtk_box_pack_start (GTK_BOX (vbox1), hbuttonbox1, TRUE, TRUE, 0); - gtk_button_box_set_spacing (GTK_BUTTON_BOX (hbuttonbox1), 0); - button1 = gtk_button_new_with_label ("Ok"); - gtk_widget_ref (button1); - gtk_object_set_data_full (GTK_OBJECT (Config), "button1", button1, - (GtkDestroyNotify) gtk_widget_unref); + button1 = gtk_button_new_from_stock ("gtk-ok"); gtk_widget_show (button1); gtk_container_add (GTK_CONTAINER (hbuttonbox1), button1); GTK_WIDGET_SET_FLAGS (button1, GTK_CAN_DEFAULT); - button2 = gtk_button_new_with_label ("Cancel"); - gtk_widget_ref (button2); - gtk_object_set_data_full (GTK_OBJECT (Config), "button2", button2, - (GtkDestroyNotify) gtk_widget_unref); + button2 = gtk_button_new_from_stock ("gtk-cancel"); gtk_widget_show (button2); gtk_container_add (GTK_CONTAINER (hbuttonbox1), button2); GTK_WIDGET_SET_FLAGS (button2, GTK_CAN_DEFAULT); - gtk_signal_connect (GTK_OBJECT (button5), "clicked", - GTK_SIGNAL_FUNC (OnFileSel), - NULL); - gtk_signal_connect (GTK_OBJECT (button6), "clicked", - GTK_SIGNAL_FUNC (OnStop), - NULL); - gtk_signal_connect (GTK_OBJECT (GtkButton_Compress), "clicked", - GTK_SIGNAL_FUNC (OnCompress), - NULL); - gtk_signal_connect (GTK_OBJECT (GtkButton_Decompress), "clicked", - GTK_SIGNAL_FUNC (OnDecompress), - NULL); - gtk_signal_connect (GTK_OBJECT (GtkButton_Create), "clicked", - GTK_SIGNAL_FUNC (OnCreate), - NULL); - gtk_signal_connect (GTK_OBJECT (GtkButton_CreateZ), "clicked", - GTK_SIGNAL_FUNC (OnCreateZ), - NULL); - gtk_signal_connect (GTK_OBJECT (button1), "clicked", - GTK_SIGNAL_FUNC (OnOk), - NULL); - gtk_signal_connect (GTK_OBJECT (button2), "clicked", - GTK_SIGNAL_FUNC (OnCancel), - NULL); + g_signal_connect ((gpointer) button5, "clicked", + G_CALLBACK (OnFileSel), + NULL); + g_signal_connect ((gpointer) button6, "clicked", + G_CALLBACK (OnStop), + NULL); + g_signal_connect ((gpointer) GtkButton_Compress, "clicked", + G_CALLBACK (OnCompress), + NULL); + g_signal_connect ((gpointer) GtkButton_Decompress, "clicked", + G_CALLBACK (OnDecompress), + NULL); + g_signal_connect ((gpointer) GtkButton_Create, "clicked", + G_CALLBACK (OnCreate), + NULL); + g_signal_connect ((gpointer) GtkButton_CreateZ, "clicked", + G_CALLBACK (OnCreateZ), + NULL); + g_signal_connect ((gpointer) button1, "clicked", + G_CALLBACK (OnOk), + NULL); + g_signal_connect ((gpointer) button2, "clicked", + G_CALLBACK (OnCancel), + NULL); + + /* Store pointers to all widgets, for use by lookup_widget(). */ + GLADE_HOOKUP_OBJECT_NO_REF (Config, Config, "Config"); + GLADE_HOOKUP_OBJECT (Config, vbox1, "vbox1"); + GLADE_HOOKUP_OBJECT (Config, hbox1, "hbox1"); + GLADE_HOOKUP_OBJECT (Config, GtkEntry_Iso, "GtkEntry_Iso"); + GLADE_HOOKUP_OBJECT (Config, button5, "button5"); + GLADE_HOOKUP_OBJECT (Config, hbox2, "hbox2"); + GLADE_HOOKUP_OBJECT (Config, GtkProgressBar_Progress, "GtkProgressBar_Progress"); + GLADE_HOOKUP_OBJECT (Config, button6, "button6"); + GLADE_HOOKUP_OBJECT (Config, hbox4, "hbox4"); + GLADE_HOOKUP_OBJECT (Config, label2, "label2"); + GLADE_HOOKUP_OBJECT (Config, GtkCombo_Method, "GtkCombo_Method"); + GLADE_HOOKUP_OBJECT (Config, combo_entry1, "combo_entry1"); + GLADE_HOOKUP_OBJECT (Config, hbuttonbox2, "hbuttonbox2"); + GLADE_HOOKUP_OBJECT (Config, GtkButton_Compress, "GtkButton_Compress"); + GLADE_HOOKUP_OBJECT (Config, GtkButton_Decompress, "GtkButton_Decompress"); + GLADE_HOOKUP_OBJECT (Config, hbox3, "hbox3"); + GLADE_HOOKUP_OBJECT (Config, label1, "label1"); + GLADE_HOOKUP_OBJECT (Config, GtkEntry_CdDev, "GtkEntry_CdDev"); + GLADE_HOOKUP_OBJECT (Config, hbuttonbox3, "hbuttonbox3"); + GLADE_HOOKUP_OBJECT (Config, GtkButton_Create, "GtkButton_Create"); + GLADE_HOOKUP_OBJECT (Config, GtkButton_CreateZ, "GtkButton_CreateZ"); + GLADE_HOOKUP_OBJECT (Config, hbuttonbox1, "hbuttonbox1"); + GLADE_HOOKUP_OBJECT (Config, button1, "button1"); + GLADE_HOOKUP_OBJECT (Config, button2, "button2"); return Config; } diff --git a/plugins/CDVDiso/src/Linux/support.c b/plugins/CDVDiso/src/Linux/support.c index c4984e5a9d..00aff29822 100644 --- a/plugins/CDVDiso/src/Linux/support.c +++ b/plugins/CDVDiso/src/Linux/support.c @@ -10,18 +10,12 @@ #include #include #include +#include #include #include "support.h" -/* This is an internally used function to check if a pixmap file exists. */ -static gchar* check_file_exists (const gchar *directory, - const gchar *filename); - -/* This is an internally used function to create pixmaps. */ -static GtkWidget* create_dummy_pixmap (GtkWidget *widget); - GtkWidget* lookup_widget (GtkWidget *widget, const gchar *widget_name) @@ -34,47 +28,20 @@ lookup_widget (GtkWidget *widget, parent = gtk_menu_get_attach_widget (GTK_MENU (widget)); else parent = widget->parent; + if (!parent) + parent = (GtkWidget*) g_object_get_data (G_OBJECT (widget), "GladeParentKey"); if (parent == NULL) break; widget = parent; } - found_widget = (GtkWidget*) gtk_object_get_data (GTK_OBJECT (widget), - widget_name); + found_widget = (GtkWidget*) g_object_get_data (G_OBJECT (widget), + widget_name); if (!found_widget) g_warning ("Widget not found: %s", widget_name); return found_widget; } -/* This is a dummy pixmap we use when a pixmap can't be found. */ -static char *dummy_pixmap_xpm[] = { -/* columns rows colors chars-per-pixel */ -"1 1 1 1", -" c None", -/* pixels */ -" " -}; - -/* This is an internally used function to create pixmaps. */ -static GtkWidget* -create_dummy_pixmap (GtkWidget *widget) -{ - GdkColormap *colormap; - GdkPixmap *gdkpixmap; - GdkBitmap *mask; - GtkWidget *pixmap; - - colormap = gtk_widget_get_colormap (widget); - gdkpixmap = gdk_pixmap_colormap_create_from_xpm_d (NULL, colormap, &mask, - NULL, dummy_pixmap_xpm); - if (gdkpixmap == NULL) - g_error ("Couldn't create replacement pixmap."); - pixmap = gtk_pixmap_new (gdkpixmap, mask); - gdk_pixmap_unref (gdkpixmap); - gdk_bitmap_unref (mask); - return pixmap; -} - static GList *pixmaps_directories = NULL; /* Use this function to set the directory containing installed pixmaps. */ @@ -85,78 +52,93 @@ add_pixmap_directory (const gchar *directory) g_strdup (directory)); } +/* This is an internally used function to find pixmap files. */ +static gchar* +find_pixmap_file (const gchar *filename) +{ + GList *elem; + + /* We step through each of the pixmaps directory to find it. */ + elem = pixmaps_directories; + while (elem) + { + gchar *pathname = g_strdup_printf ("%s%s%s", (gchar*)elem->data, + G_DIR_SEPARATOR_S, filename); + if (g_file_test (pathname, G_FILE_TEST_EXISTS)) + return pathname; + g_free (pathname); + elem = elem->next; + } + return NULL; +} + /* This is an internally used function to create pixmaps. */ GtkWidget* create_pixmap (GtkWidget *widget, const gchar *filename) { - gchar *found_filename = NULL; - GdkColormap *colormap; - GdkPixmap *gdkpixmap; - GdkBitmap *mask; + gchar *pathname = NULL; GtkWidget *pixmap; - GList *elem; if (!filename || !filename[0]) - return create_dummy_pixmap (widget); + return gtk_image_new (); - /* We first try any pixmaps directories set by the application. */ - elem = pixmaps_directories; - while (elem) + pathname = find_pixmap_file (filename); + + if (!pathname) { - found_filename = check_file_exists ((gchar*)elem->data, filename); - if (found_filename) - break; - elem = elem->next; + g_warning (_("Couldn't find pixmap file: %s"), filename); + return gtk_image_new (); } - /* If we haven't found the pixmap, try the source directory. */ - if (!found_filename) - { - found_filename = check_file_exists ("", filename); - } - - if (!found_filename) - { - g_warning ("Couldn't find pixmap file: %s", filename); - return create_dummy_pixmap (widget); - } - - colormap = gtk_widget_get_colormap (widget); - gdkpixmap = gdk_pixmap_colormap_create_from_xpm (NULL, colormap, &mask, - NULL, found_filename); - if (gdkpixmap == NULL) - { - g_warning ("Error loading pixmap file: %s", found_filename); - g_free (found_filename); - return create_dummy_pixmap (widget); - } - g_free (found_filename); - pixmap = gtk_pixmap_new (gdkpixmap, mask); - gdk_pixmap_unref (gdkpixmap); - gdk_bitmap_unref (mask); + pixmap = gtk_image_new_from_file (pathname); + g_free (pathname); return pixmap; } -/* This is an internally used function to check if a pixmap file exists. */ -gchar* -check_file_exists (const gchar *directory, - const gchar *filename) +/* This is an internally used function to create pixmaps. */ +GdkPixbuf* +create_pixbuf (const gchar *filename) { - gchar *full_filename; - struct stat s; - gint status; + gchar *pathname = NULL; + GdkPixbuf *pixbuf; + GError *error = NULL; - full_filename = (gchar*) g_malloc (strlen (directory) + 1 - + strlen (filename) + 1); - strcpy (full_filename, directory); - strcat (full_filename, G_DIR_SEPARATOR_S); - strcat (full_filename, filename); + if (!filename || !filename[0]) + return NULL; - status = stat (full_filename, &s); - if (status == 0 && S_ISREG (s.st_mode)) - return full_filename; - g_free (full_filename); - return NULL; + pathname = find_pixmap_file (filename); + + if (!pathname) + { + g_warning (_("Couldn't find pixmap file: %s"), filename); + return NULL; + } + + pixbuf = gdk_pixbuf_new_from_file (pathname, &error); + if (!pixbuf) + { + fprintf (stderr, "Failed to load pixbuf file: %s: %s\n", + pathname, error->message); + g_error_free (error); + } + g_free (pathname); + return pixbuf; +} + +/* This is used to set ATK action descriptions. */ +void +glade_set_atk_action_description (AtkAction *action, + const gchar *action_name, + const gchar *description) +{ + gint n_actions, i; + + n_actions = atk_action_get_n_actions (action); + for (i = 0; i < n_actions; i++) + { + if (!strcmp (atk_action_get_name (action, i), action_name)) + atk_action_set_description (action, i, description); + } } diff --git a/plugins/CDVDiso/src/Linux/support.h b/plugins/CDVDiso/src/Linux/support.h index aee31f935d..a32649e53c 100644 --- a/plugins/CDVDiso/src/Linux/support.h +++ b/plugins/CDVDiso/src/Linux/support.h @@ -8,6 +8,31 @@ #include +/* + * Standard gettext macros. + */ +#ifdef ENABLE_NLS +# include +# undef _ +# define _(String) dgettext (PACKAGE, String) +# define Q_(String) g_strip_context ((String), gettext (String)) +# ifdef gettext_noop +# define N_(String) gettext_noop (String) +# else +# define N_(String) (String) +# endif +#else +# define textdomain(String) (String) +# define gettext(String) (String) +# define dgettext(Domain,Message) (Message) +# define dcgettext(Domain,Message,Type) (Message) +# define bindtextdomain(Domain,Directory) (Domain) +# define _(String) (String) +# define Q_(String) g_strip_context ((String), (String)) +# define N_(String) (String) +#endif + + /* * Public Functions. */ @@ -21,8 +46,6 @@ GtkWidget* lookup_widget (GtkWidget *widget, const gchar *widget_name); -/* get_widget() is deprecated. Use lookup_widget instead. */ -#define get_widget lookup_widget /* Use this function to set the directory containing installed pixmaps. */ void add_pixmap_directory (const gchar *directory); @@ -32,7 +55,15 @@ void add_pixmap_directory (const gchar *directory); * Private Functions. */ -/* This is used to create the pixmaps in the interface. */ +/* This is used to create the pixmaps used in the interface. */ GtkWidget* create_pixmap (GtkWidget *widget, const gchar *filename); +/* This is used to create the pixbufs used in the interface. */ +GdkPixbuf* create_pixbuf (const gchar *filename); + +/* This is used to set ATK action descriptions. */ +void glade_set_atk_action_description (AtkAction *action, + const gchar *action_name, + const gchar *description); +