[dia] [gtk-deprecated] GtkComboBoxEntry is gone, welcome GtkComboBoxText



commit 7d9c0015c642efa9b6c6317b5d86f2e94ad878c8
Author: Hans Breuer <hans breuer org>
Date:   Sun Mar 27 12:20:39 2011 +0200

    [gtk-deprecated] GtkComboBoxEntry is gone, welcome GtkComboBoxText
    
    Also gtk_quit_add() is gone, this one w/o a comment in Gtk, but
    a g_print() in Dia, i.e. remains todo, but compiles.

 app/menus.c |   37 +++++++++++++++++++++++++++++++++----
 1 files changed, 33 insertions(+), 4 deletions(-)
---
diff --git a/app/menus.c b/app/menus.c
index e566a19..e601e3e 100644
--- a/app/menus.c
+++ b/app/menus.c
@@ -418,8 +418,8 @@ void integrated_ui_toolbar_set_zoom_text (GtkToolbar *toolbar, const gchar * tex
 {
   if (toolbar)
   {
-    GtkComboBoxEntry *combo_entry = g_object_get_data (G_OBJECT (toolbar), 
-                                                       DIA_INTEGRATED_TOOLBAR_ZOOM_COMBO);
+    GtkComboBox *combo_entry = g_object_get_data (G_OBJECT (toolbar), 
+                                                  DIA_INTEGRATED_TOOLBAR_ZOOM_COMBO);
     
     if (combo_entry)
     {
@@ -476,8 +476,15 @@ integrated_ui_toolbar_zoom_combo_selection_changed (GtkComboBox *combo,
     if (gtk_combo_box_get_active (combo) != -1)
     {
         float zoom_percent;
-        gchar * text = gtk_combo_box_get_active_text (combo);
-
+        gchar * text;
+#if GTK_CHECK_VERSION(2,24,0)
+	if (gtk_combo_box_get_has_entry (combo))
+	  text = g_strdup (gtk_entry_get_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (combo)))));
+	else
+	  text = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT (combo));
+#else
+	text = gtk_combo_box_get_active_text (combo);
+#endif
         if (sscanf (text, "%f", &zoom_percent) == 1)
         {
             view_zoom_set (zoom_percent * 10.0);
@@ -554,13 +561,30 @@ create_integrated_ui_toolbar (void)
   g_free (uifile);  
 
   /* Zoom Combo Box Entry */
+#if GTK_CHECK_VERSION(2,24,0)
+  w = gtk_combo_box_text_new_with_entry ();
+#else
   w = gtk_combo_box_entry_new_text ();
+#endif
 
   g_object_set_data (G_OBJECT (toolbar), 
                      DIA_INTEGRATED_TOOLBAR_ZOOM_COMBO,
                      w);
   integrated_ui_toolbar_add_custom_item (toolbar, w);
  
+#if GTK_CHECK_VERSION(2,24,0)
+  gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (w), ZOOM_FIT);
+  gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (w), _("800%"));
+  gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (w), _("400%"));
+  gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (w), _("300%"));
+  gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (w), _("200%"));
+  gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (w), _("150%"));
+  gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (w), _("100%"));
+  gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (w), _("75%"));
+  gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (w), _("50%"));
+  gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (w), _("25%"));
+  gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (w), _("10%"));
+#else
   gtk_combo_box_append_text (GTK_COMBO_BOX (w), ZOOM_FIT);
   gtk_combo_box_append_text (GTK_COMBO_BOX (w), _("800%"));
   gtk_combo_box_append_text (GTK_COMBO_BOX (w), _("400%"));
@@ -572,6 +596,7 @@ create_integrated_ui_toolbar (void)
   gtk_combo_box_append_text (GTK_COMBO_BOX (w), _("50%"));
   gtk_combo_box_append_text (GTK_COMBO_BOX (w), _("25%"));
   gtk_combo_box_append_text (GTK_COMBO_BOX (w), _("10%"));
+#endif
 
   g_signal_connect (G_OBJECT (w), 
                     "changed",
@@ -949,7 +974,11 @@ menus_init(void)
     gtk_accel_map_load(accelfilename);
     g_free(accelfilename);
   }
+#if GTK_CHECK_VERSION(2,24,0)
+  g_print ("TODO: Check accels being saved ...");
+#else
   gtk_quit_add(1, save_accels, NULL);
+#endif
 }
 
 void



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