Add a cancel button on the custom message diaog
authorXavier Claessens <xclaesse@src.gnome.org>
Sun, 20 Jan 2008 00:04:43 +0000 (00:04 +0000)
committerXavier Claessens <xclaesse@src.gnome.org>
Sun, 20 Jan 2008 00:04:43 +0000 (00:04 +0000)
svn path=/trunk/; revision=583

libempathy-gtk/empathy-presence-chooser.c
libempathy-gtk/empathy-presence-chooser.glade

index a8b69e02f8695a0e641ac22e98595c56385c772a..17a627389469736e6b07b0172d281505d1ba0490 100644 (file)
@@ -901,16 +901,27 @@ presence_chooser_dialog_setup (CustomMessageDialog *dialog)
 }
 
 static void
-presence_chooser_dialog_destroy_cb (GtkWidget           *widget,
-                                   CustomMessageDialog *dialog)
+presence_chooser_dialog_response_cb (GtkWidget           *widget,
+                                    gint                 response,
+                                    CustomMessageDialog *dialog)
 {
-       McPresence   state;
-       const gchar *text;
+       if (response == GTK_RESPONSE_APPLY) {
+               McPresence   state;
+               const gchar *text;
 
-       state = presence_chooser_dialog_get_selected (dialog);
-       text = gtk_entry_get_text (GTK_ENTRY (dialog->entry_message));
+               state = presence_chooser_dialog_get_selected (dialog);
+               text = gtk_entry_get_text (GTK_ENTRY (dialog->entry_message));
+
+               presence_chooser_set_state (state, text);
+       }
+
+       gtk_widget_destroy (widget);
+}
 
-       presence_chooser_set_state (state, text);
+static void
+presence_chooser_dialog_destroy_cb (GtkWidget           *widget,
+                                   CustomMessageDialog *dialog)
+{
 
        g_free (dialog);
        message_dialog = NULL;
@@ -938,7 +949,7 @@ presence_chooser_dialog_show (void)
        empathy_glade_connect (glade,
                               message_dialog,
                               "custom_message_dialog", "destroy", presence_chooser_dialog_destroy_cb,
-                              "custom_message_dialog", "response", gtk_widget_destroy,
+                              "custom_message_dialog", "response", presence_chooser_dialog_response_cb,
                               "combobox_status", "changed", presence_chooser_dialog_status_changed_cb,
                               "checkbutton_save", "toggled", presence_chooser_dialog_save_toggled_cb,
                               NULL);
index 9433d26513589af43eb5c96072dc2821d129639b..a3a26a156151439842bd123768f5cc48f597465a 100644 (file)
@@ -5,6 +5,7 @@
 <requires lib="gnome"/>
 
 <widget class="GtkDialog" id="custom_message_dialog">
+  <property name="border_width">5</property>
   <property name="visible">True</property>
   <property name="title" translatable="yes">Custom message</property>
   <property name="type">GTK_WINDOW_TOPLEVEL</property>
@@ -20,7 +21,6 @@
   <property name="focus_on_map">True</property>
   <property name="urgency_hint">False</property>
   <property name="has_separator">False</property>
-  <property name="border_width">5</property>
 
   <child internal-child="vbox">
     <widget class="GtkVBox" id="dialog-vbox6">
              <property name="visible">True</property>
              <property name="can_default">True</property>
              <property name="can_focus">True</property>
-             <property name="label">gtk-close</property>
+             <property name="label">gtk-cancel</property>
+             <property name="use_stock">True</property>
+             <property name="relief">GTK_RELIEF_NORMAL</property>
+             <property name="focus_on_click">True</property>
+             <property name="response_id">-6</property>
+           </widget>
+         </child>
+
+         <child>
+           <widget class="GtkButton" id="button1">
+             <property name="visible">True</property>
+             <property name="can_default">True</property>
+             <property name="can_focus">True</property>
+             <property name="label">gtk-apply</property>
              <property name="use_stock">True</property>
              <property name="relief">GTK_RELIEF_NORMAL</property>
              <property name="focus_on_click">True</property>
-             <property name="response_id">-7</property>
+             <property name="response_id">-10</property>
            </widget>
          </child>
        </widget>
 
       <child>
        <widget class="GtkTable" id="table1">
+         <property name="border_width">5</property>
          <property name="visible">True</property>
          <property name="n_rows">3</property>
          <property name="n_columns">2</property>
          <property name="homogeneous">False</property>
          <property name="row_spacing">6</property>
          <property name="column_spacing">6</property>
-         <property name="border_width">5</property>
 
          <child>
            <widget class="GtkLabel" id="label471">