[frogr] Do not use GtkComboBoxText if GTK < 2.24



commit d28ccdb8861c6c745108e38d2573ef5a6c815a10
Author: Mario Sanchez Prada <msanchez igalia com>
Date:   Sat Jul 9 11:12:44 2011 +0200

    Do not use GtkComboBoxText if GTK < 2.24

 src/frogr-details-dialog.c  |   29 ++++++++++++++++++++---------
 src/frogr-settings-dialog.c |   28 ++++++++++++++++++++--------
 2 files changed, 40 insertions(+), 17 deletions(-)
---
diff --git a/src/frogr-details-dialog.c b/src/frogr-details-dialog.c
index 013262f..55e4a67 100644
--- a/src/frogr-details-dialog.c
+++ b/src/frogr-details-dialog.c
@@ -88,6 +88,18 @@ enum {
   N_COLS
 };
 
+static const gchar *license_descriptions[] = {
+  N_("Default (as specified in flickr)"),
+  N_("None (All rights reserved)"),
+  N_("CC Attribution-NonCommercial-ShareAlike"),
+  N_("CC Attribution-NonCommercial"),
+  N_("CC Attribution-NonCommercial-NoDerivs"),
+  N_("CC Attribution"),
+  N_("CC Attribution-ShareAlike"),
+  N_("CC Attribution-NoDerivs"),
+  NULL
+};
+
 
 /* Prototypes */
 
@@ -149,6 +161,7 @@ _create_widgets (FrogrDetailsDialog *self)
   GtkWidget *scroller = NULL;
   GtkTreeModel *model = NULL;
   gchar *markup = NULL;
+  gint i;
 
   priv = FROGR_DETAILS_DIALOG_GET_PRIVATE (self);
 
@@ -353,17 +366,15 @@ _create_widgets (FrogrDetailsDialog *self)
   gtk_container_add (GTK_CONTAINER (align), widget);
   gtk_box_pack_start (GTK_BOX (section_vbox), align, FALSE, FALSE, 0);
 
+#if GTK_CHECK_VERSION (2,24,0)
   widget = gtk_combo_box_text_new ();
-  gtk_combo_box_text_insert_text (GTK_COMBO_BOX_TEXT (widget), 0, _("Default (as specified in flickr)"));
-  gtk_combo_box_text_insert_text (GTK_COMBO_BOX_TEXT (widget), 1, _("None (All rights reserved)"));
-  gtk_combo_box_text_insert_text (GTK_COMBO_BOX_TEXT (widget), 2, _("CC Attribution-NonCommercial-ShareAlike"));
-  gtk_combo_box_text_insert_text (GTK_COMBO_BOX_TEXT (widget), 3, _("CC Attribution-NonCommercial"));
-  gtk_combo_box_text_insert_text (GTK_COMBO_BOX_TEXT (widget), 4, _("CC Attribution-NonCommercial-NoDerivs"));
-  gtk_combo_box_text_insert_text (GTK_COMBO_BOX_TEXT (widget), 5, _("CC Attribution"));
-  gtk_combo_box_text_insert_text (GTK_COMBO_BOX_TEXT (widget), 6, _("CC Attribution-ShareAlike"));
-  gtk_combo_box_text_insert_text (GTK_COMBO_BOX_TEXT (widget), 7, _("CC Attribution-NoDerivs"));
+  for (i = 0; license_descriptions[i]; i++)
+    gtk_combo_box_text_insert_text (GTK_COMBO_BOX_TEXT (widget), i, gettext (license_descriptions[i]));
+#else
+  for (i = 0; license_descriptions[i]; i++)
+    gtk_combo_box_insert_text (GTK_COMBO_BOX (widget), i, gettext (license_descriptions[i]));
+#endif
   priv->license_cb = widget;
-
   gtk_box_pack_start (GTK_BOX (section_vbox), widget, FALSE, FALSE, 0);
 
   gtk_box_pack_start (GTK_BOX (vbox), section_vbox, FALSE, FALSE, 6);
diff --git a/src/frogr-settings-dialog.c b/src/frogr-settings-dialog.c
index 050cc9f..1339ad1 100644
--- a/src/frogr-settings-dialog.c
+++ b/src/frogr-settings-dialog.c
@@ -88,6 +88,18 @@ typedef struct _FrogrSettingsDialogPrivate {
 
 static FrogrSettingsDialog *_instance = NULL;
 
+static const gchar *license_descriptions[] = {
+  N_("Default (as specified in flickr)"),
+  N_("None (All rights reserved)"),
+  N_("CC Attribution-NonCommercial-ShareAlike"),
+  N_("CC Attribution-NonCommercial"),
+  N_("CC Attribution-NonCommercial-NoDerivs"),
+  N_("CC Attribution"),
+  N_("CC Attribution-ShareAlike"),
+  N_("CC Attribution-NoDerivs"),
+  NULL
+};
+
 /* Prototypes */
 
 static void _add_togleabble_item (FrogrSettingsDialog *self, GtkBox *box,
@@ -154,6 +166,7 @@ _add_general_page (FrogrSettingsDialog *self, GtkNotebook *notebook)
   GtkWidget *label = NULL;
   GtkWidget *combo = NULL;
   gchar *markup = NULL;
+  gint i;
 
   priv = FROGR_SETTINGS_DIALOG_GET_PRIVATE (self);
 
@@ -285,15 +298,14 @@ _add_general_page (FrogrSettingsDialog *self, GtkNotebook *notebook)
   gtk_container_add (GTK_CONTAINER (align), label);
   gtk_box_pack_start (GTK_BOX (vbox), align, FALSE, FALSE, 6);
 
+#if GTK_CHECK_VERSION (2,24,0)
   combo = gtk_combo_box_text_new ();
-  gtk_combo_box_text_insert_text (GTK_COMBO_BOX_TEXT (combo), 0, _("Default (as specified in flickr)"));
-  gtk_combo_box_text_insert_text (GTK_COMBO_BOX_TEXT (combo), 1, _("None (All rights reserved)"));
-  gtk_combo_box_text_insert_text (GTK_COMBO_BOX_TEXT (combo), 2, _("CC Attribution-NonCommercial-ShareAlike"));
-  gtk_combo_box_text_insert_text (GTK_COMBO_BOX_TEXT (combo), 3, _("CC Attribution-NonCommercial"));
-  gtk_combo_box_text_insert_text (GTK_COMBO_BOX_TEXT (combo), 4, _("CC Attribution-NonCommercial-NoDerivs"));
-  gtk_combo_box_text_insert_text (GTK_COMBO_BOX_TEXT (combo), 5, _("CC Attribution"));
-  gtk_combo_box_text_insert_text (GTK_COMBO_BOX_TEXT (combo), 6, _("CC Attribution-ShareAlike"));
-  gtk_combo_box_text_insert_text (GTK_COMBO_BOX_TEXT (combo), 7, _("CC Attribution-NoDerivs"));
+  for (i = 0; license_descriptions[i]; i++)
+    gtk_combo_box_text_insert_text (GTK_COMBO_BOX_TEXT (combo), i, gettext (license_descriptions[i]));
+#else
+  for (i = 0; license_descriptions[i]; i++)
+    gtk_combo_box_insert_text (GTK_COMBO_BOX (combo), i, gettext (license_descriptions[i]));
+#endif
   gtk_box_pack_start (GTK_BOX (vbox), combo, FALSE, FALSE, 0);
   priv->license_cb = combo;
 



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