[gnome-system-tools] Stop using GtkComboBoxEntry
- From: Milan Bouchet-Valat <milanbv src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-system-tools] Stop using GtkComboBoxEntry
- Date: Sun, 12 Dec 2010 17:45:29 +0000 (UTC)
commit 4bb658370d1c4b3e73efa603b0e2f94bce4da798
Author: Milan Bouchet-Valat <nalimilan club fr>
Date: Sun Dec 12 12:46:37 2010 +0100
Stop using GtkComboBoxEntry
Use GtkComboBoxText or GtkComboBox with a child entry. This is needed
to move to GTK3.
interfaces/network.ui | 13 +++++--------
interfaces/time.ui | 4 ++--
interfaces/users.ui | 13 +++++++++----
src/network/connection.c | 14 ++++++++------
src/time/time-tool.c | 8 ++------
src/users/table.c | 2 +-
src/users/user-settings.c | 26 ++++++++++++++++----------
7 files changed, 43 insertions(+), 37 deletions(-)
---
diff --git a/interfaces/network.ui b/interfaces/network.ui
index c83e2bc..20fba3c 100644
--- a/interfaces/network.ui
+++ b/interfaces/network.ui
@@ -763,8 +763,9 @@
</packing>
</child>
<child>
- <object class="GtkComboBoxEntry" id="connection_essid">
+ <object class="GtkComboBox" id="connection_essid">
<property name="visible">True</property>
+ <property name="has-entry">True</property>
</object>
<packing>
<property name="left_attach">1</property>
@@ -1410,15 +1411,11 @@
</packing>
</child>
<child>
- <object class="GtkComboBoxEntry" id="connection_serial_port">
+ <object class="GtkComboBox" id="connection_serial_port">
<property name="visible">True</property>
+ <property name="has-entry">True</property>
+ <property name="entry-text-column">0</property>
<property name="model">liststore3</property>
- <child>
- <object class="GtkCellRendererText" id="cellrenderertext3"/>
- <attributes>
- <attribute name="text">0</attribute>
- </attributes>
- </child>
</object>
<packing>
<property name="left_attach">1</property>
diff --git a/interfaces/time.ui b/interfaces/time.ui
index ed2e2c1..98a8500 100644
--- a/interfaces/time.ui
+++ b/interfaces/time.ui
@@ -112,9 +112,9 @@
</packing>
</child>
<child>
- <object class="GtkComboBox" id="location_combo">
+ <object class="GtkComboBoxText" id="location_combo">
<property name="visible">True</property>
- <property name="model">location_model</property>
+ <property name="entry-text-column">0</property>
</object>
<packing>
<property name="position">1</property>
diff --git a/interfaces/users.ui b/interfaces/users.ui
index da70782..a69b04e 100644
--- a/interfaces/users.ui
+++ b/interfaces/users.ui
@@ -856,8 +856,10 @@
</packing>
</child>
<child>
- <object class="GtkComboBoxEntry" id="profile_settings_shell">
+ <object class="GtkComboBox" id="profile_settings_shell">
<property name="visible">True</property>
+ <property name="has-entry">True</property>
+ <property name="entry-text-column">0</property>
</object>
<packing>
<property name="left_attach">2</property>
@@ -2466,10 +2468,11 @@
</packing>
</child>
<child>
- <object class="GtkComboBoxEntry" id="user_new_login">
+ <object class="GtkComboBoxText" id="user_new_login">
<property name="visible">True</property>
<property name="model">liststore2</property>
- <property name="text_column">0</property>
+ <property name="has-entry">True</property>
+ <property name="entry-text-column">0</property>
<signal name="changed" handler="on_user_new_login_changed"/>
</object>
<packing>
@@ -2896,8 +2899,10 @@
</packing>
</child>
<child>
- <object class="GtkComboBoxEntry" id="user_settings_shell">
+ <object class="GtkComboBox" id="user_settings_shell">
<property name="visible">True</property>
+ <property name="has-entry">True</property>
+ <property name="entry-text-column">0</property>
</object>
<packing>
<property name="left_attach">2</property>
diff --git a/src/network/connection.c b/src/network/connection.c
index 35940d1..77af78d 100644
--- a/src/network/connection.c
+++ b/src/network/connection.c
@@ -21,6 +21,8 @@
#include <string.h>
#include <glib/gi18n.h>
+#include <gtk/gtk.h>
+
#include "gst.h"
#include "network-tool.h"
#include "connection.h"
@@ -113,7 +115,7 @@ connection_combo_get_value (GtkComboBox *combo)
}
static void
-connection_essids_combo_init (GtkComboBoxEntry *combo)
+connection_essids_combo_init (GtkComboBox *combo)
{
GtkTreeModel *model;
GtkCellRenderer *renderer;
@@ -138,10 +140,10 @@ connection_essids_combo_init (GtkComboBoxEntry *combo)
renderer, "value", 2);
/* reuse text cell renderer for the essid */
- gtk_combo_box_entry_set_text_column (combo, 1);
+ gtk_combo_box_set_entry_text_column (combo, 1);
- g_signal_connect (gtk_bin_get_child (GTK_BIN (combo)), "changed",
- G_CALLBACK (on_dialog_changed), tool);
+ g_signal_connect (G_OBJECT (combo), "changed",
+ G_CALLBACK (on_dialog_changed), tool);
}
static void
@@ -670,9 +672,9 @@ connection_dialog_init (GstTool *tool)
gcd->isp_frame = gst_dialog_get_widget (tool->main_dialog, "isp_data");
gcd->account_frame = gst_dialog_get_widget (tool->main_dialog, "isp_account_data");
- gtk_combo_box_entry_set_text_column (GTK_COMBO_BOX_ENTRY (gcd->serial_port), 0);
+ gtk_combo_box_set_entry_text_column (GTK_COMBO_BOX (gcd->serial_port), 0);
- connection_essids_combo_init (GTK_COMBO_BOX_ENTRY (gcd->essid));
+ connection_essids_combo_init (GTK_COMBO_BOX (gcd->essid));
connection_pppoe_combo_init (GTK_COMBO_BOX (gcd->pppoe_interface_combo));
return gcd;
diff --git a/src/time/time-tool.c b/src/time/time-tool.c
index cf9767f..e762e02 100644
--- a/src/time/time-tool.c
+++ b/src/time/time-tool.c
@@ -345,7 +345,6 @@ init_timezone (GstTimeTool *time_tool)
{
GstTool *tool = GST_TOOL (time_tool);
GtkWidget *w;
- GtkCellRenderer *cell;
GPtrArray *locs;
guint i;
@@ -357,14 +356,11 @@ init_timezone (GstTimeTool *time_tool)
gtk_widget_show (GTK_WIDGET (time_tool->tzmap->map));
w = gst_dialog_get_widget (tool->main_dialog, "location_combo");
- cell = gtk_cell_renderer_text_new ();
- gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (w), cell, TRUE);
- gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (w), cell, "text", 0, NULL);
locs = tz_get_locations (e_tz_map_get_tz_db (time_tool->tzmap));
for (i = 0; i < locs->len; i++)
- gtk_combo_box_append_text (GTK_COMBO_BOX (w),
- tz_location_get_zone (g_ptr_array_index (locs, i)));
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (w),
+ tz_location_get_zone (g_ptr_array_index (locs, i)));
time_tool->timezone_dialog = gst_dialog_get_widget (tool->main_dialog, "time_zone_window");
}
diff --git a/src/users/table.c b/src/users/table.c
index ae9912a..45bd41e 100644
--- a/src/users/table.c
+++ b/src/users/table.c
@@ -106,7 +106,7 @@ setup_shells_combo (GstUsersTool *tool)
gtk_combo_box_set_model (GTK_COMBO_BOX (combo), model);
g_object_unref (model);
- gtk_combo_box_entry_set_text_column (GTK_COMBO_BOX_ENTRY (combo), 0);
+ gtk_combo_box_set_entry_text_column (GTK_COMBO_BOX (combo), 0);
}
void
diff --git a/src/users/user-settings.c b/src/users/user-settings.c
index 49317f3..cb15092 100644
--- a/src/users/user-settings.c
+++ b/src/users/user-settings.c
@@ -897,32 +897,38 @@ on_user_new_name_changed (GtkEditable *user_name, gpointer user_data)
used_login = oobs_users_config_is_login_used (config, item1->str);
if (nwords2 > 0 && !used_login && !isdigit(item1->str[0]))
- gtk_combo_box_append_text (GTK_COMBO_BOX (user_login), item1->str);
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (user_login),
+ item1->str);
/* if there's only one word, would be the same as item1 */
if (nwords2 > 1) {
/* add other items */
used_login = oobs_users_config_is_login_used (config, item2->str);
if (!used_login && !isdigit(item2->str[0]))
- gtk_combo_box_append_text (GTK_COMBO_BOX (user_login), item2->str);
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (user_login),
+ item2->str);
used_login = oobs_users_config_is_login_used (config, item3->str);
if (!used_login && !isdigit(item3->str[0]))
- gtk_combo_box_append_text (GTK_COMBO_BOX (user_login), item3->str);
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (user_login),
+ item3->str);
used_login = oobs_users_config_is_login_used (config, item4->str);
if (!used_login && !isdigit(item4->str[0]))
- gtk_combo_box_append_text (GTK_COMBO_BOX (user_login), item4->str);
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (user_login),
+ item4->str);
/* add the last word */
used_login = oobs_users_config_is_login_used (config, last_word->str);
if (!used_login && !isdigit(last_word->str[0]))
- gtk_combo_box_append_text (GTK_COMBO_BOX (user_login), last_word->str);
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (user_login),
+ last_word->str);
/* ...and the first one */
used_login = oobs_users_config_is_login_used (config, first_word->str);
if (!used_login && !isdigit(first_word->str[0]))
- gtk_combo_box_append_text (GTK_COMBO_BOX (user_login), first_word->str);
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (user_login),
+ first_word->str);
}
@@ -955,10 +961,10 @@ on_user_new_login_changed (GtkComboBox *login_combo, gpointer user_data)
gboolean empty_login;
gboolean valid_login;
gboolean valid_name;
- char *login;
- char *c;
+ const char *login;
+ const char *c;
- login = gtk_combo_box_get_active_text (login_combo);
+ login = gtk_entry_get_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (login_combo))));
login_entry = gtk_bin_get_child (GTK_BIN (login_combo));
validate_button = gst_dialog_get_widget (tool->main_dialog, "user_new_validate_button");
notice_image = gst_dialog_get_widget (tool->main_dialog, "user_new_notice_image");
@@ -1081,7 +1087,7 @@ on_user_new (GtkButton *button, gpointer user_data)
/* Create user with base data entered by the user.
Main group will be automatically managed by the backends,
following the system configuration. */
- login = gtk_combo_box_get_active_text (GTK_COMBO_BOX (user_login));
+ login = gtk_entry_get_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (user_login))));
fullname = gtk_entry_get_text (GTK_ENTRY (user_name));
encrypt = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (encrypted_home));
user = oobs_user_new (login);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]