Mercurial > audlegacy
changeset 901:9d09a5e6c3d5 trunk
[svn] prevent timidity aboutbox from spawning multiple times
author | giacomo |
---|---|
date | Thu, 30 Mar 2006 13:55:46 -0800 |
parents | 9eaff2f6cd4b |
children | c130ba2a5524 |
files | Plugins/Input/timidity/src/interface.c Plugins/Input/timidity/src/interface.h Plugins/Input/timidity/src/xmms-timidity.c |
diffstat | 3 files changed, 14 insertions(+), 96 deletions(-) [+] |
line wrap: on
line diff
--- a/Plugins/Input/timidity/src/interface.c Thu Mar 30 13:47:45 2006 -0800 +++ b/Plugins/Input/timidity/src/interface.c Thu Mar 30 13:55:46 2006 -0800 @@ -244,85 +244,3 @@ gtk_widget_grab_default (conf_ok); return xmmstimid_conf_wnd; } - -GtkWidget* -create_xmmstimid_about_wnd (void) -{ - GtkWidget *xmmstimid_about_wnd; - GtkWidget *vbox6; - GtkWidget *vbox7; - GtkWidget *name_version; - GtkWidget *label2; - GtkWidget *hseparator2; - GtkWidget *hbuttonbox2; - GtkWidget *button3; - - xmmstimid_about_wnd = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_object_set_data (GTK_OBJECT (xmmstimid_about_wnd), "xmmstimid_about_wnd", xmmstimid_about_wnd); - gtk_window_set_title (GTK_WINDOW (xmmstimid_about_wnd), _("About TiMidity Plugin")); - gtk_window_set_position (GTK_WINDOW (xmmstimid_about_wnd), GTK_WIN_POS_MOUSE); - - vbox6 = gtk_vbox_new (FALSE, 0); - gtk_widget_ref (vbox6); - gtk_object_set_data_full (GTK_OBJECT (xmmstimid_about_wnd), "vbox6", vbox6, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (vbox6); - gtk_container_add (GTK_CONTAINER (xmmstimid_about_wnd), vbox6); - - vbox7 = gtk_vbox_new (FALSE, 0); - gtk_widget_ref (vbox7); - gtk_object_set_data_full (GTK_OBJECT (xmmstimid_about_wnd), "vbox7", vbox7, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (vbox7); - gtk_box_pack_start (GTK_BOX (vbox6), vbox7, TRUE, TRUE, 0); - gtk_container_set_border_width (GTK_CONTAINER (vbox7), 20); - - name_version = gtk_label_new (_("TiMidity Plugin")); - gtk_widget_ref (name_version); - gtk_object_set_data_full (GTK_OBJECT (xmmstimid_about_wnd), "name_version", name_version, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (name_version); - gtk_box_pack_start (GTK_BOX (vbox7), name_version, TRUE, TRUE, 0); - gtk_misc_set_alignment (GTK_MISC (name_version), 0.5, 1); - - label2 = gtk_label_new (_("http://libtimidity.sourceforge.net\nby Konstantin Korikov")); - gtk_widget_ref (label2); - gtk_object_set_data_full (GTK_OBJECT (xmmstimid_about_wnd), "label2", label2, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (label2); - gtk_box_pack_start (GTK_BOX (vbox7), label2, TRUE, TRUE, 0); - gtk_misc_set_alignment (GTK_MISC (label2), 0.5, 7.45058e-09); - - hseparator2 = gtk_hseparator_new (); - gtk_widget_ref (hseparator2); - gtk_object_set_data_full (GTK_OBJECT (xmmstimid_about_wnd), "hseparator2", hseparator2, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (hseparator2); - gtk_box_pack_start (GTK_BOX (vbox6), hseparator2, FALSE, TRUE, 0); - - hbuttonbox2 = gtk_hbutton_box_new (); - gtk_widget_ref (hbuttonbox2); - gtk_object_set_data_full (GTK_OBJECT (xmmstimid_about_wnd), "hbuttonbox2", hbuttonbox2, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (hbuttonbox2); - gtk_box_pack_start (GTK_BOX (vbox6), hbuttonbox2, FALSE, TRUE, 0); - gtk_container_set_border_width (GTK_CONTAINER (hbuttonbox2), 5); - gtk_button_box_set_layout (GTK_BUTTON_BOX (hbuttonbox2), GTK_BUTTONBOX_END); - - button3 = gtk_button_new_with_label (_("Ok")); - gtk_widget_ref (button3); - gtk_object_set_data_full (GTK_OBJECT (xmmstimid_about_wnd), "button3", button3, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (button3); - gtk_container_add (GTK_CONTAINER (hbuttonbox2), button3); - GTK_WIDGET_SET_FLAGS (button3, GTK_CAN_DEFAULT); - - gtk_signal_connect_object (GTK_OBJECT (button3), "clicked", - GTK_SIGNAL_FUNC (gtk_widget_hide), - GTK_OBJECT (xmmstimid_about_wnd)); - - gtk_widget_grab_focus (button3); - gtk_widget_grab_default (button3); - return xmmstimid_about_wnd; -} -
--- a/Plugins/Input/timidity/src/interface.h Thu Mar 30 13:47:45 2006 -0800 +++ b/Plugins/Input/timidity/src/interface.h Thu Mar 30 13:55:46 2006 -0800 @@ -3,4 +3,3 @@ */ GtkWidget* create_xmmstimid_conf_wnd (void); -GtkWidget* create_xmmstimid_about_wnd (void);
--- a/Plugins/Input/timidity/src/xmms-timidity.c Thu Mar 30 13:47:45 2006 -0800 +++ b/Plugins/Input/timidity/src/xmms-timidity.c Thu Mar 30 13:55:46 2006 -0800 @@ -128,20 +128,21 @@ } void xmmstimid_about(void) { - if (xmmstimid_about_wnd == NULL) { - gchar *name_version; - xmmstimid_about_wnd = create_xmmstimid_about_wnd(); - name_version = g_strdup_printf( - _("TiMidity Plugin %s"), PACKAGE_VERSION); - gtk_label_set_text( - GTK_LABEL(gtk_object_get_data( - GTK_OBJECT(xmmstimid_about_wnd), - "name_version")), name_version); - g_free(name_version); + if (!xmmstimid_about_wnd) { + gchar *about_title, *about_text; + about_text = g_strjoin( "" , + _("TiMidity Plugin\nhttp://libtimidity.sourceforge.net\nby Konstantin Korikov") , NULL ); + about_title = g_strdup_printf( _("TiMidity Plugin %s") , PACKAGE_VERSION ); + xmmstimid_about_wnd = xmms_show_message( about_title , about_text , _("Ok") , FALSE , NULL , NULL ); + gtk_signal_connect(GTK_OBJECT(xmmstimid_about_wnd), "destroy", + (GCallback)gtk_widget_destroyed, &xmmstimid_about_wnd); + g_free(about_title); + g_free(about_text); } - - gtk_widget_show(xmmstimid_about_wnd); - gdk_window_raise(xmmstimid_about_wnd->window); + else + { + gdk_window_raise(xmmstimid_about_wnd->window); + } } void xmmstimid_conf_ok(GtkButton *button, gpointer user_data);