[evolution-webcal] Bug 572175 - Remove deprecated GTK+ symbols (Original patch from shuiyu <shuiyu cn gmail com>)



commit f28289909e8af4405aa5cf63d6b12df8c4af2585
Author: Roberto Guido <bob4mail gmail com>
Date:   Tue Apr 13 16:53:01 2010 +0200

    Bug 572175 - Remove deprecated GTK+ symbols (Original patch from shuiyu <shuiyu cn gmail com>)

 src/evolution-webcal-notify.c |   67 ++++++++++-------------------------------
 1 files changed, 16 insertions(+), 51 deletions(-)
---
diff --git a/src/evolution-webcal-notify.c b/src/evolution-webcal-notify.c
index f05f991..8b0d61b 100644
--- a/src/evolution-webcal-notify.c
+++ b/src/evolution-webcal-notify.c
@@ -89,14 +89,9 @@ static void e_webcal_icon_theme_changed (GtkIconTheme * theme,
 				"x-office-calendar", GTK_ICON_SIZE_DIALOG);
 }
 
-static void e_webcal_change_adjustment (GtkMenuShell * shell,
-					GtkWidget * spinner) {
-  GtkWidget * widget;
-
-  widget = gtk_menu_get_active (GTK_MENU (shell));
-
-  if (widget != NULL) {
-    switch (g_list_index (shell->children, widget)) {
+static void e_webcal_change_adjustment (GtkComboBox * combo,
+                                       GtkWidget * spinner) {
+  switch (gtk_combo_box_get_active (combo)) {
     case E_ICALSHARE_TIMEOUT_DAYS:
       gtk_spin_button_set_range (GTK_SPIN_BUTTON (spinner), 1, 6);
       gtk_spin_button_set_value (GTK_SPIN_BUTTON (spinner), 1);
@@ -113,22 +108,7 @@ static void e_webcal_change_adjustment (GtkMenuShell * shell,
       gtk_spin_button_set_range (GTK_SPIN_BUTTON (spinner), 1, 23);
       gtk_spin_button_set_value (GTK_SPIN_BUTTON (spinner), 1);
       break;
-    }
-  }
-}
-
-static gint e_webcal_option_menu_get (GtkOptionMenu * menu) {
-  GtkWidget * widget;
-
-  g_return_val_if_fail (GTK_IS_OPTION_MENU (menu), -1);
-
-  widget = gtk_menu_get_active (GTK_MENU (menu->menu));
-
-  if (widget != NULL) {
-    return g_list_index (GTK_MENU_SHELL (menu->menu)->children, widget);
   }
-
-  return -1;
 }
 
 void e_webcal_display_error (const gchar * title, const gchar * message,
@@ -234,8 +214,7 @@ void e_webcal_query_user (const gchar * name, const gchar * desc,
                           gboolean has_events, gboolean has_tasks) {
   EIcalShareDialog * dialog;
   GtkObject * spinadj;
-  GtkWidget * tspinb, * toption;
-  GtkWidget * menu, * mitem;
+  GtkWidget * tspinb, * combo;
   GtkWidget * vbox, * hbox;
   GtkWidget * lbox, * wbox, * xbox;
   GtkWidget * rlabel, * clabel;
@@ -473,36 +452,22 @@ void e_webcal_query_user (const gchar * name, const gchar * desc,
 
   gtk_label_set_mnemonic_widget (GTK_LABEL (rlabel), tspinb);
 
-  toption = gtk_option_menu_new ();
-  gtk_box_pack_start (GTK_BOX (hbox), toption, FALSE, FALSE, 0);
-  gtk_widget_show (toption);
-
-  menu = gtk_menu_new ();
-
-  mitem = gtk_menu_item_new_with_label (_("Days"));
-  gtk_menu_shell_append (GTK_MENU_SHELL (menu), mitem);
-  gtk_widget_show (mitem);
-
-  mitem = gtk_menu_item_new_with_label (_("Hours"));
-  gtk_menu_shell_append (GTK_MENU_SHELL (menu), mitem);
-  gtk_widget_show (mitem);
-
-  mitem = gtk_menu_item_new_with_label (_("Minutes"));
-  gtk_menu_shell_append (GTK_MENU_SHELL (menu), mitem);
-  gtk_widget_show (mitem);
+  combo = gtk_combo_box_new_text ();
+  gtk_box_pack_start (GTK_BOX (hbox), combo, FALSE, FALSE, 0);
+  gtk_widget_show (combo);
 
-  mitem = gtk_menu_item_new_with_label (_("Weeks"));
-  gtk_menu_shell_append (GTK_MENU_SHELL (menu), mitem);
-  gtk_widget_show (mitem);
+  gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Days"));
+  gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Hours"));
+  gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Minutes"));
+  gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Weeks"));
 
-  gtk_option_menu_set_menu (GTK_OPTION_MENU (toption), menu);
-  gtk_option_menu_set_history (GTK_OPTION_MENU (toption),
-			       E_ICALSHARE_TIMEOUT_HOURS);
+  gtk_combo_box_set_active (GTK_COMBO_BOX (combo),
+                           E_ICALSHARE_TIMEOUT_HOURS);
 
   /* If the user changes the units of time, we want to update the spin
      button with more appropriate ranges for the time to refresh */
-  g_signal_connect (G_OBJECT (menu), "deactivate",
-		    G_CALLBACK (e_webcal_change_adjustment), tspinb);
+  g_signal_connect (combo, "changed",
+                   G_CALLBACK (e_webcal_change_adjustment), tspinb);
 
   /* Color button for the calendar properties */
   hbox = gtk_hbox_new (FALSE, 6);
@@ -527,7 +492,7 @@ void e_webcal_query_user (const gchar * name, const gchar * desc,
   case GTK_RESPONSE_HELP:
     break;
   case GTK_RESPONSE_OK:
-    switch (e_webcal_option_menu_get (GTK_OPTION_MENU (toption))) {
+    switch (gtk_combo_box_get_active (GTK_COMBO_BOX (combo))) {
     case E_ICALSHARE_TIMEOUT_DAYS:
       ref_multi = 1440;
       break;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]