xref: /OK3568_Linux_fs/yocto/poky/meta/recipes-connectivity/connman/connman-gnome/0001-Port-to-Gtk3.patch (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1From a59b0fac02e74a971ac3f08bf28c17ce361a9526 Mon Sep 17 00:00:00 2001
2From: Jussi Kukkonen <jussi.kukkonen@intel.com>
3Date: Wed, 2 Mar 2016 15:47:49 +0200
4Subject: [PATCH] Port to Gtk3
5
6Some unused (or not useful) code was removed, functionality should stay
7the same.
8
9Code still contains quite a few uses of deprecated API.
10
11Upstream-Status: Submitted
12Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>
13---
14 applet/agent.c        |  3 +--
15 applet/main.c         | 43 -------------------------------------------
16 applet/status.c       |  8 --------
17 configure.ac          |  3 +--
18 properties/ethernet.c | 14 +++++++-------
19 properties/main.c     |  2 +-
20 properties/wifi.c     | 12 ++++++------
21 7 files changed, 16 insertions(+), 69 deletions(-)
22
23diff --git a/applet/agent.c b/applet/agent.c
24index 65bed08..04fe86a 100644
25--- a/applet/agent.c
26+++ b/applet/agent.c
27@@ -126,7 +126,6 @@ static void request_input_dialog(GHashTable *request,
28 	gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_CENTER);
29 	gtk_window_set_keep_above(GTK_WINDOW(dialog), TRUE);
30 	gtk_window_set_urgency_hint(GTK_WINDOW(dialog), TRUE);
31-	gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE);
32 	input->dialog = dialog;
33
34 	gtk_dialog_add_button(GTK_DIALOG(dialog),
35@@ -139,7 +138,7 @@ static void request_input_dialog(GHashTable *request,
36 	gtk_table_set_row_spacings(GTK_TABLE(table), 4);
37 	gtk_table_set_col_spacings(GTK_TABLE(table), 20);
38 	gtk_container_set_border_width(GTK_CONTAINER(table), 12);
39-	gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), table);
40+	gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area (GTK_DIALOG(dialog))), table);
41
42 	label = gtk_label_new(_("Please provide some network information:"));
43 	gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.0);
44diff --git a/applet/main.c b/applet/main.c
45index f12d371..cd16285 100644
46--- a/applet/main.c
47+++ b/applet/main.c
48@@ -157,46 +157,6 @@ static void name_owner_changed(DBusGProxy *proxy, const char *name,
49 	}
50 }
51
52-static void open_uri(GtkWindow *parent, const char *uri)
53-{
54-	GtkWidget *dialog;
55-	GdkScreen *screen;
56-	GError *error = NULL;
57-	gchar *cmdline;
58-
59-	screen = gtk_window_get_screen(parent);
60-
61-	cmdline = g_strconcat("xdg-open ", uri, NULL);
62-
63-	if (gdk_spawn_command_line_on_screen(screen,
64-				cmdline, &error) == FALSE) {
65-		dialog = gtk_message_dialog_new(parent,
66-				GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR,
67-				GTK_BUTTONS_CLOSE, "%s", error->message);
68-		gtk_dialog_run(GTK_DIALOG(dialog));
69-		gtk_widget_destroy(dialog);
70-		g_error_free(error);
71-	}
72-
73-	g_free(cmdline);
74-}
75-
76-static void about_url_hook(GtkAboutDialog *dialog,
77-				const gchar *url, gpointer data)
78-{
79-	open_uri(GTK_WINDOW(dialog), url);
80-}
81-
82-static void about_email_hook(GtkAboutDialog *dialog,
83-				const gchar *email, gpointer data)
84-{
85-	gchar *uri;
86-
87-	uri = g_strconcat("mailto:", email, NULL);
88-	open_uri(GTK_WINDOW(dialog), uri);
89-	g_free(uri);
90-}
91-
92 static void about_callback(GtkWidget *item, gpointer user_data)
93 {
94 	const gchar *authors[] = {
95@@ -204,9 +164,6 @@ static void about_callback(GtkWidget *item, gpointer user_data)
96 		NULL
97 	};
98
99-	gtk_about_dialog_set_url_hook(about_url_hook, NULL, NULL);
100-	gtk_about_dialog_set_email_hook(about_email_hook, NULL, NULL);
101-
102 	gtk_show_about_dialog(NULL, "version", VERSION,
103 			"copyright", "Copyright \xc2\xa9 2008 Intel Corporation",
104 			"comments", _("A connection manager for the GNOME desktop"),
105diff --git a/applet/status.c b/applet/status.c
106index aed6f1e..015ff29 100644
107--- a/applet/status.c
108+++ b/applet/status.c
109@@ -102,8 +102,6 @@ static void icon_animation_start(IconAnimation *animation,
110 {
111 	available = TRUE;
112
113-	gtk_status_icon_set_tooltip(statusicon, NULL);
114-
115 	animation->start = start;
116 	animation->end = (end == 0) ? animation->count - 1 : end;
117
118@@ -120,8 +118,6 @@ static void icon_animation_stop(IconAnimation *animation)
119 {
120 	available = TRUE;
121
122-	gtk_status_icon_set_tooltip(statusicon, NULL);
123-
124 	if (animation->id > 0)
125 		g_source_remove(animation->id);
126
127@@ -251,8 +247,6 @@ void status_unavailable(void)
128 	available = FALSE;
129
130 	gtk_status_icon_set_from_pixbuf(statusicon, pixbuf_notifier);
131-	gtk_status_icon_set_tooltip(statusicon,
132-				"Connection Manager daemon is not running");
133
134 	gtk_status_icon_set_visible(statusicon, TRUE);
135 }
136@@ -299,7 +293,6 @@ static void set_ready(gint signal)
137
138 	if (signal < 0) {
139 		gtk_status_icon_set_from_pixbuf(statusicon, pixbuf_wired);
140-		gtk_status_icon_set_tooltip(statusicon, NULL);
141 		return;
142 	}
143
144@@ -311,7 +304,6 @@ static void set_ready(gint signal)
145 		index = 4;
146
147 	gtk_status_icon_set_from_pixbuf(statusicon, pixbuf_signal[index]);
148-	gtk_status_icon_set_tooltip(statusicon, NULL);
149 }
150
151 struct timeout_data {
152diff --git a/configure.ac b/configure.ac
153index b972e07..a4dad5d 100644
154--- a/configure.ac
155+++ b/configure.ac
156@@ -55,8 +55,7 @@ AC_SUBST(DBUS_LIBS)
157 DBUS_BINDING_TOOL="dbus-binding-tool"
158 AC_SUBST(DBUS_BINDING_TOOL)
159
160-PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.8, dummy=yes,
161-				AC_MSG_ERROR(gtk+ >= 2.8 is required))
162+PKG_CHECK_MODULES(GTK, gtk+-3.0)
163 AC_SUBST(GTK_CFLAGS)
164 AC_SUBST(GTK_LIBS)
165
166diff --git a/properties/ethernet.c b/properties/ethernet.c
167index 31db7a0..0b6b423 100644
168--- a/properties/ethernet.c
169+++ b/properties/ethernet.c
170@@ -82,7 +82,7 @@ void add_ethernet_switch_button(GtkWidget *mainbox, GtkTreeIter *iter,
171 	gtk_container_set_border_width(GTK_CONTAINER(vbox), 24);
172 	gtk_box_pack_start(GTK_BOX(mainbox), vbox, FALSE, FALSE, 0);
173
174-	table = gtk_table_new(1, 1, TRUE);
175+	table = gtk_table_new(1, 1, FALSE);
176 	gtk_table_set_row_spacings(GTK_TABLE(table), 10);
177 	gtk_table_set_col_spacings(GTK_TABLE(table), 10);
178 	gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0);
179@@ -136,7 +136,7 @@ void add_ethernet_service(GtkWidget *mainbox, GtkTreeIter *iter, struct config_d
180 	gtk_container_set_border_width(GTK_CONTAINER(vbox), 24);
181 	gtk_box_pack_start(GTK_BOX(mainbox), vbox, FALSE, FALSE, 0);
182
183-	table = gtk_table_new(5, 5, TRUE);
184+	table = gtk_table_new(5, 5, FALSE);
185 	gtk_table_set_row_spacings(GTK_TABLE(table), 10);
186 	gtk_table_set_col_spacings(GTK_TABLE(table), 10);
187 	gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0);
188@@ -144,9 +144,9 @@ void add_ethernet_service(GtkWidget *mainbox, GtkTreeIter *iter, struct config_d
189 	label = gtk_label_new(_("Configuration:"));
190 	gtk_table_attach_defaults(GTK_TABLE(table), label, 1, 2, 0, 1);
191
192-	combo = gtk_combo_box_new_text();
193-	gtk_combo_box_append_text(GTK_COMBO_BOX(combo), "DHCP");
194-	gtk_combo_box_append_text(GTK_COMBO_BOX(combo), "MANUAL");
195+	combo = gtk_combo_box_text_new();
196+	gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), "DHCP");
197+	gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), "MANUAL");
198 	gtk_combo_box_set_row_separator_func(GTK_COMBO_BOX(combo),
199 					separator_function, NULL, NULL);
200 	gtk_table_attach_defaults(GTK_TABLE(table), combo, 2, 4, 0, 1);
201@@ -219,7 +219,7 @@ void update_ethernet_ipv4(struct config_data *data, guint policy)
202 	case CONNMAN_POLICY_DHCP:
203 		gtk_combo_box_set_active(GTK_COMBO_BOX(combo), 0);
204 		for (i = 0; i < 3; i++) {
205-			gtk_entry_set_editable(GTK_ENTRY(entry[i]), 0);
206+			gtk_editable_set_editable(GTK_EDITABLE(entry[i]), 0);
207 			gtk_widget_set_sensitive(entry[i], 0);
208 			gtk_entry_set_text(GTK_ENTRY(entry[i]), _(""));
209 		}
210@@ -227,7 +227,7 @@ void update_ethernet_ipv4(struct config_data *data, guint policy)
211 	case CONNMAN_POLICY_MANUAL:
212 		gtk_combo_box_set_active(GTK_COMBO_BOX(combo), 1);
213 		for (i = 0; i < 3; i++) {
214-			gtk_entry_set_editable(GTK_ENTRY(entry[i]), 1);
215+			gtk_editable_set_editable(GTK_EDITABLE(entry[i]), 1);
216 			gtk_widget_set_sensitive(entry[i], 1);
217 		}
218 		break;
219diff --git a/properties/main.c b/properties/main.c
220index c05f443..6f76361 100644
221--- a/properties/main.c
222+++ b/properties/main.c
223@@ -429,7 +429,7 @@ static GtkWidget *create_interfaces(GtkWidget *window)
224
225 	scrolled = gtk_scrolled_window_new(NULL, NULL);
226 	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled),
227-				GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
228+				GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
229 	gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolled),
230 							GTK_SHADOW_OUT);
231 	gtk_box_pack_start(GTK_BOX(hbox), scrolled, FALSE, TRUE, 0);
232diff --git a/properties/wifi.c b/properties/wifi.c
233index bd325ef..a5827e0 100644
234--- a/properties/wifi.c
235+++ b/properties/wifi.c
236@@ -125,7 +125,7 @@ void add_wifi_switch_button(GtkWidget *mainbox, GtkTreeIter *iter,
237 	gtk_container_set_border_width(GTK_CONTAINER(vbox), 24);
238 	gtk_box_pack_start(GTK_BOX(mainbox), vbox, FALSE, FALSE, 0);
239
240-	table = gtk_table_new(1, 1, TRUE);
241+	table = gtk_table_new(1, 1, FALSE);
242 	gtk_table_set_row_spacings(GTK_TABLE(table), 10);
243 	gtk_table_set_col_spacings(GTK_TABLE(table), 10);
244 	gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0);
245@@ -185,9 +185,9 @@ static void wifi_ipconfig(GtkWidget *table, struct config_data *data, GtkTreeIte
246 	gtk_table_attach_defaults(GTK_TABLE(table), label, 1, 2, 3, 4);
247 	data->ipv4.label[0] = label;
248
249-	combo = gtk_combo_box_new_text();
250-	gtk_combo_box_append_text(GTK_COMBO_BOX(combo), "DHCP");
251-	gtk_combo_box_append_text(GTK_COMBO_BOX(combo), "Manual");
252+	combo = gtk_combo_box_text_new();
253+	gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), "DHCP");
254+	gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), "Manual");
255
256 	gtk_combo_box_set_row_separator_func(GTK_COMBO_BOX(combo),
257 			separator_function, NULL, NULL);
258@@ -335,14 +335,14 @@ void update_wifi_ipv4(struct config_data *data, guint policy)
259 	case CONNMAN_POLICY_DHCP:
260 		gtk_combo_box_set_active(GTK_COMBO_BOX(combo), 0);
261 		for (i = 0; i < 3; i++) {
262-			gtk_entry_set_editable(GTK_ENTRY(entry[i]), 0);
263+			gtk_editable_set_editable(GTK_EDITABLE(entry[i]), 0);
264 			gtk_widget_set_sensitive(entry[i], 0);
265 		}
266 		break;
267 	case CONNMAN_POLICY_MANUAL:
268 		gtk_combo_box_set_active(GTK_COMBO_BOX(combo), 1);
269 		for (i = 0; i < 3; i++) {
270-			gtk_entry_set_editable(GTK_ENTRY(entry[i]), 1);
271+			gtk_editable_set_editable(GTK_EDITABLE(entry[i]), 1);
272 			gtk_widget_set_sensitive(entry[i], 1);
273 		}
274 		break;
275--
2762.8.1
277
278