[anjuta-extras] scratchbox: Fix bgo #652700 - Scratchbox plugin uses long deprecated GTK2 API
- From: Sebastien Granjoux <sgranjoux src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta-extras] scratchbox: Fix bgo #652700 - Scratchbox plugin uses long deprecated GTK2 API
- Date: Sat, 18 Jun 2011 08:53:01 +0000 (UTC)
commit d3eeac971ff946e0c9cfd1021d47a4650f52a616
Author: SÃbastien Granjoux <seb sfo free fr>
Date: Sat Jun 18 10:52:32 2011 +0200
scratchbox: Fix bgo #652700 - Scratchbox plugin uses long deprecated GTK2 API
plugins/scratchbox/anjuta-scratchbox.ui | 89 ++++++++++++++++--------------
plugins/scratchbox/plugin.c | 34 +++++-------
2 files changed, 60 insertions(+), 63 deletions(-)
---
diff --git a/plugins/scratchbox/anjuta-scratchbox.ui b/plugins/scratchbox/anjuta-scratchbox.ui
index 04ce0f6..760ca05 100644
--- a/plugins/scratchbox/anjuta-scratchbox.ui
+++ b/plugins/scratchbox/anjuta-scratchbox.ui
@@ -1,8 +1,9 @@
-<?xml version="1.0"?>
-<!--*- mode: xml -*-->
+<?xml version="1.0" encoding="UTF-8"?>
<interface>
+ <!-- interface-requires gtk+ 2.12 -->
<object class="GtkListStore" id="model1">
<columns>
+ <!-- column-name gchararray -->
<column type="gchararray"/>
</columns>
<data>
@@ -16,6 +17,7 @@
</object>
<object class="GtkListStore" id="model2">
<columns>
+ <!-- column-name gchararray -->
<column type="gchararray"/>
</columns>
<data>
@@ -25,29 +27,34 @@
</data>
</object>
<object class="GtkWindow" id="preferences_dialog_scratchbox">
+ <property name="can_focus">False</property>
<property name="title" translatable="yes">window1</property>
<child>
<object class="GtkFrame" id="Scratchbox">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="border_width">10</property>
<property name="label_xalign">0</property>
<property name="label_yalign">0</property>
- <property name="shadow_type">GTK_SHADOW_NONE</property>
+ <property name="shadow_type">none</property>
<child>
<object class="GtkAlignment" id="alignment1">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="yalign">0</property>
<property name="left_padding">12</property>
<child>
<object class="GtkTable" id="table1">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="column_spacing">5</property>
<property name="row_spacing">5</property>
<child>
<object class="GtkHSeparator" id="hseparator2">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
</object>
<packing>
<property name="right_attach">2</property>
@@ -58,6 +65,7 @@
<child>
<object class="GtkHSeparator" id="hseparator1">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
</object>
<packing>
<property name="right_attach">2</property>
@@ -70,9 +78,10 @@
<child>
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="xpad">5</property>
<property name="label" translatable="yes">Scratchbox directory:</property>
- <property name="justify">GTK_JUSTIFY_RIGHT</property>
+ <property name="justify">right</property>
</object>
<packing>
<property name="top_attach">2</property>
@@ -84,9 +93,10 @@
<child>
<object class="GtkLabel" id="label2">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">Scratchbox version:</property>
- <property name="justify">GTK_JUSTIFY_RIGHT</property>
+ <property name="justify">right</property>
</object>
<packing>
<property name="top_attach">1</property>
@@ -96,32 +106,12 @@
</packing>
</child>
<child>
- <object class="GtkComboBox" id="preferences_combo:text:Sbox1,Sbox2:0:scratchbox-version">
- <property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="model">model1</property>
- <child>
- <object class="GtkCellRendererText" id="renderer1"/>
- <attributes>
- <attribute name="text">0</attribute>
- </attributes>
- </child>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options">GTK_FILL</property>
- </packing>
- </child>
- <child>
<object class="GtkFileChooserButton" id="preferences_folder:text:/scratchbox:0:build-scratchbox-path">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="action">select-folder</property>
<property name="preview_widget_active">False</property>
- <property name="action">GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER</property>
<property name="title" translatable="yes">Select Scratchbox Folder</property>
</object>
<packing>
@@ -130,15 +120,16 @@
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
- <property name="y_options"/>
+ <property name="y_options"></property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label3">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">Scratchbox target:</property>
- <property name="justify">GTK_JUSTIFY_RIGHT</property>
+ <property name="justify">right</property>
</object>
<packing>
<property name="top_attach">3</property>
@@ -148,23 +139,34 @@
</packing>
</child>
<child>
- <object class="GtkComboBox" id="combo_target">
+ <object class="GtkComboBoxText" id="preferences_combo:text:Sbox1,Sbox2:0:scratchbox-version">
<property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="model">model2</property>
- <child>
- <object class="GtkCellRendererText" id="renderer2"/>
- <attributes>
- <attribute name="text">0</attribute>
- </attributes>
- </child>
+ <property name="can_focus">False</property>
+ <items>
+ <item translatable="yes">Sbox1</item>
+ <item translatable="yes">Sbox2</item>
+ </items>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBoxText" id="preferences_combo:text:None:0:scratchbox-target">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
- <property name="y_options"/>
+ <property name="y_options">GTK_FILL</property>
</packing>
</child>
</object>
@@ -174,17 +176,19 @@
<child type="label">
<object class="GtkTable" id="table2">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="homogeneous">True</property>
<child>
<object class="GtkLabel" id="label106">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="yalign">0</property>
<property name="ypad">14</property>
<property name="label" translatable="yes"><b>Scratchbox Options</b>
</property>
<property name="use_markup">True</property>
- <property name="justify">GTK_JUSTIFY_FILL</property>
+ <property name="justify">fill</property>
</object>
<packing>
<property name="left_attach">1</property>
@@ -194,11 +198,12 @@
<child>
<object class="GtkImage" id="anjuta-scratchbox-panel">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="pixbuf">anjuta-scratchbox-panel.png</property>
</object>
<packing>
- <property name="x_options"/>
- <property name="y_options"/>
+ <property name="x_options"></property>
+ <property name="y_options"></property>
</packing>
</child>
</object>
diff --git a/plugins/scratchbox/plugin.c b/plugins/scratchbox/plugin.c
index 75a1bda..74cb449 100644
--- a/plugins/scratchbox/plugin.c
+++ b/plugins/scratchbox/plugin.c
@@ -36,15 +36,16 @@
*---------------------------------------------------------------------------*/
#define ICON_FILE "anjuta-scratchbox-48.png"
-#define GLADE_FILE PACKAGE_DATA_DIR"/glade/anjuta-scratchbox.ui"
+#define GLADE_FILE PACKAGE_DATA_DIR "/glade/anjuta-scratchbox.ui"
#define SB_SCHEMA "org.gnome.anjuta.scratchbox"
#define SB_ENTRY "preferences_folder:text:/scratchbox:0:build-scratchbox-path"
-#define SB_TARGET_ENTRY "combo_target"
+#define SB_TARGET_ENTRY "preferences_combo:text:None:0:scratchbox-target"
#define SB_SBOX_ENTRY "preferences_combo:text:Sbox1,Sbox2:0:scratchbox-version"
#define PREF_SB_PATH "build-scratchbox-path"
#define PREF_SB_VERSION "scratchbox-version"
+#define PREF_SB_TARGET "scratchbox-target"
/* Type defintions
*---------------------------------------------------------------------------*/
@@ -64,7 +65,6 @@ struct _ScratchboxPlugin
gchar **target_list;
gchar *sb_dir;
gchar *target;
- gint id;
gint combo_element;
GString *buffer;
@@ -129,18 +129,18 @@ static void on_list_terminated (AnjutaLauncher *launcher, gint child_pid,
SB_TARGET_ENTRY));
for (i = 1; i < plugin->combo_element; i++)
- gtk_combo_box_remove_text(GTK_COMBO_BOX(combo_target_entry), 1);
+ gtk_combo_box_text_remove (GTK_COMBO_BOX_TEXT(combo_target_entry), 1);
plugin->combo_element = 1;
for (i = 0; i < str_splitted_length; i++) {
- gtk_combo_box_append_text(GTK_COMBO_BOX(combo_target_entry), plugin->target_list[i]);
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT(combo_target_entry), plugin->target_list[i]);
+ if (g_strcmp0 (plugin->target, plugin->target_list[i]) == 0) gtk_combo_box_set_active (GTK_COMBO_BOX(combo_target_entry), i);
plugin->combo_element++;
}
/* enable target combo box */
- gtk_combo_box_set_active (GTK_COMBO_BOX(combo_target_entry),
- plugin->id);
- gtk_widget_set_sensitive(combo_target_entry, TRUE);
+
+ gtk_widget_set_sensitive(combo_target_entry, TRUE);
g_strfreev (plugin->target_list);
}
@@ -161,21 +161,14 @@ static void on_target (AnjutaLauncher *launcher, AnjutaLauncherOutputType out,
static void
on_change_target(GtkComboBox *combo, ScratchboxPlugin *plugin)
{
- AnjutaShell* shell = ANJUTA_PLUGIN (plugin)->shell;
- gint id;
-
g_return_if_fail (plugin != NULL);
- id = gtk_combo_box_get_active (combo);
if (plugin->target) {
g_free(plugin->target);
plugin->target = NULL;
}
- plugin->target = gtk_combo_box_get_active_text (combo);
- plugin->id = id > 0 ? id :0;
+ plugin->target = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (combo));
- anjuta_preferences_set_int (anjuta_shell_get_preferences (shell, NULL),
- SB_TARGET_ENTRY,
- plugin->id);
+ g_settings_set_string (plugin->settings, PREF_SB_TARGET, plugin->target);
}
static void
@@ -462,7 +455,7 @@ ipreferences_merge(IAnjutaPreferences* ipref, AnjutaPreferences* prefs, GError**
combo_sbox_entry = GTK_WIDGET(gtk_builder_get_object(bxml, SB_SBOX_ENTRY));
chooser_dir_entry = GTK_WIDGET(gtk_builder_get_object(bxml, SB_ENTRY));
- plugin->id = anjuta_preferences_get_int(prefs, SB_TARGET_ENTRY);
+ plugin->target = g_settings_get_string (plugin->settings , PREF_SB_TARGET);
anjuta_preferences_add_from_builder (prefs, bxml, plugin->settings, "Scratchbox", _("Scratchbox"), ICON_FILE);
g_signal_connect(chooser_dir_entry, "current-folder-changed",
@@ -475,8 +468,8 @@ ipreferences_merge(IAnjutaPreferences* ipref, AnjutaPreferences* prefs, GError**
"changed", G_CALLBACK(on_change_target),
plugin);
- plugin->target = gtk_combo_box_get_active_text (
- GTK_COMBO_BOX(combo_target_entry));
+ plugin->target = gtk_combo_box_text_get_active_text (
+ GTK_COMBO_BOX_TEXT(combo_target_entry));
}
static void
@@ -514,7 +507,6 @@ scratchbox_plugin_instance_init (GObject *obj)
plugin->buffer = NULL;
plugin->combo_element = 1;
plugin->launcher = NULL;
- plugin->id = 0;
plugin->target = NULL;
plugin->settings = g_settings_new (SB_SCHEMA);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]