1
Description: Backport interface to new glib url handling for web and mail
2
Origin: http://git.gnome.org/browse/gnome-control-center/log/
4
Index: gnome-control-center-2.32.1/capplets/default-applications/gnome-da-capplet.c
5
===================================================================
6
--- gnome-control-center-2.32.1.orig/capplets/default-applications/gnome-da-capplet.c 2011-01-05 12:44:35.349640872 -0500
7
+++ gnome-control-center-2.32.1/capplets/default-applications/gnome-da-capplet.c 2011-01-05 16:05:06.924153944 -0500
12
-web_radiobutton_toggled_cb (GtkWidget *togglebutton, GnomeDACapplet *capplet)
15
- GnomeDAWebItem *item;
16
- const gchar *command;
17
- GError *error = NULL;
19
- index = gtk_combo_box_get_active (GTK_COMBO_BOX (capplet->web_combo_box));
24
- item = (GnomeDAWebItem *) g_list_nth_data (capplet->web_browsers, index);
28
- if (togglebutton == capplet->new_win_radiobutton) {
29
- command = item->win_command;
31
- else if (togglebutton == capplet->new_tab_radiobutton) {
32
- command = item->tab_command;
35
- command = item->generic.command;
38
- gconf_client_set_string (capplet->gconf, DEFAULT_APPS_KEY_HTTP_EXEC, command, &error);
40
- gtk_entry_set_text (GTK_ENTRY (capplet->web_browser_command_entry), command);
42
- if (error != NULL) {
43
- g_warning (_("Error saving configuration: %s"), error->message);
44
- g_error_free (error);
49
web_combo_changed_cb (GtkComboBox *combo, GnomeDACapplet *capplet)
52
- gboolean is_custom_active;
53
- gboolean has_net_remote;
54
- GnomeDAWebItem *item;
55
- GtkWidget *active = NULL;
57
current_index = gtk_combo_box_get_active (combo);
59
if (current_index < g_list_length (capplet->web_browsers)) {
60
+ GnomeDAURLItem *item;
61
+ GError *error = NULL;
63
- item = (GnomeDAWebItem*) g_list_nth_data (capplet->web_browsers, current_index);
64
- has_net_remote = item->netscape_remote;
65
- is_custom_active = FALSE;
69
- has_net_remote = FALSE;
70
- is_custom_active = TRUE;
72
- gtk_widget_set_sensitive (capplet->default_radiobutton, has_net_remote);
73
- gtk_widget_set_sensitive (capplet->new_win_radiobutton, has_net_remote);
74
- gtk_widget_set_sensitive (capplet->new_tab_radiobutton, has_net_remote);
76
- gtk_widget_set_sensitive (capplet->web_browser_command_entry, is_custom_active);
77
- gtk_widget_set_sensitive (capplet->web_browser_command_label, is_custom_active);
78
- gtk_widget_set_sensitive (capplet->web_browser_terminal_checkbutton, is_custom_active);
80
- if (has_net_remote) {
82
- if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (capplet->new_win_radiobutton)))
83
- active = capplet->new_win_radiobutton;
84
- else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (capplet->new_tab_radiobutton)))
85
- active = capplet->new_tab_radiobutton;
87
- active = capplet->default_radiobutton;
88
+ item = (GnomeDAURLItem*) g_list_nth_data (capplet->web_browsers, current_index);
92
+ if (!g_app_info_set_as_default_for_type (item->app_info, "x-scheme-handler/http", &error) ||
93
+ !g_app_info_set_as_default_for_type (item->app_info, "x-scheme-handler/https", &error)) {
94
+ g_warning (_("Error setting default browser: %s"), error->message);
95
+ g_error_free (error);
99
- web_radiobutton_toggled_cb (active, capplet);
102
/* FIXME: Refactor these two functions below into one... */
104
mail_combo_changed_cb (GtkComboBox *combo, GnomeDACapplet *capplet)
107
- gboolean is_custom_active;
109
current_index = gtk_combo_box_get_active (combo);
110
- is_custom_active = (current_index >= g_list_length (capplet->mail_readers));
112
- gtk_widget_set_sensitive (capplet->mail_reader_command_entry, is_custom_active);
113
- gtk_widget_set_sensitive (capplet->mail_reader_command_label, is_custom_active);
114
- gtk_widget_set_sensitive (capplet->mail_reader_terminal_checkbutton, is_custom_active);
115
+ if (current_index < g_list_length (capplet->mail_readers)) {
116
+ GnomeDAURLItem *item;
117
+ GError *error = NULL;
119
+ item = (GnomeDAURLItem*) g_list_nth_data (capplet->mail_readers, current_index);
123
+ if (!g_app_info_set_as_default_for_type (item->app_info, "x-scheme-handler/mailto", &error)) {
124
+ g_warning (_("Error setting default mailer: %s"), error->message);
125
+ g_error_free (error);
133
if (capplet->icon_theme != NULL) {
134
g_signal_handlers_disconnect_by_func (capplet->icon_theme, theme_changed_cb, capplet);
136
- g_signal_connect (theme, "changed", G_CALLBACK (theme_changed_cb), capplet);
137
+ capplet->theme_changed_id = g_signal_connect (theme, "changed", G_CALLBACK (theme_changed_cb), capplet);
138
theme_changed_cb (theme, capplet);
140
capplet->icon_theme = theme;
141
@@ -297,221 +249,6 @@
142
return (strcmp (((GnomeDAItem *) list_item)->command, (gchar *) command));
146
-web_item_comp (gconstpointer item, gconstpointer command)
148
- GnomeDAWebItem *web_list_item;
150
- web_list_item = (GnomeDAWebItem *) item;
152
- if (strcmp (web_list_item->generic.command, (gchar *) command) == 0)
155
- if (web_list_item->netscape_remote) {
156
- if (strcmp (web_list_item->tab_command, (gchar *) command) == 0)
159
- if (strcmp (web_list_item->win_command, (gchar *) command) == 0)
163
- return (strcmp (web_list_item->generic.command, (gchar *) command));
167
-web_gconf_changed_cb (GConfPropertyEditor *peditor, gchar *key, GConfValue *value, GnomeDACapplet *capplet)
169
- GConfChangeSet *cs;
170
- GError *error = NULL;
173
- /* This function is used to update HTTPS,ABOUT and UNKNOWN handlers, which
174
- * should also use the same value as HTTP
177
- if (strcmp (key, DEFAULT_APPS_KEY_HTTP_EXEC) == 0) {
178
- gchar *short_browser, *pos;
179
- const gchar *value_str = gconf_value_get_string (value);
181
- cs = gconf_change_set_new ();
183
- gconf_change_set_set (cs, DEFAULT_APPS_KEY_HTTPS_EXEC, value);
184
- gconf_change_set_set (cs, DEFAULT_APPS_KEY_UNKNOWN_EXEC, value);
185
- gconf_change_set_set (cs, DEFAULT_APPS_KEY_ABOUT_EXEC, value);
186
- pos = strstr (value_str, " ");
188
- short_browser = g_strdup (value_str);
190
- short_browser = g_strndup (value_str, pos - value_str);
191
- gconf_change_set_set_string (cs, DEFAULT_APPS_KEY_BROWSER_EXEC, short_browser);
192
- g_free (short_browser);
194
- list_entry = g_list_find_custom (capplet->web_browsers,
196
- (GCompareFunc) web_item_comp);
199
- GnomeDAWebItem *item = (GnomeDAWebItem *) list_entry->data;
201
- gconf_change_set_set_bool (cs, DEFAULT_APPS_KEY_BROWSER_NREMOTE, item->netscape_remote);
204
- gconf_client_commit_change_set (capplet->gconf, cs, TRUE, &error);
206
- if (error != NULL) {
207
- g_warning (_("Error saving configuration: %s"), error->message);
208
- g_error_free (error);
212
- gconf_change_set_unref (cs);
214
- else if (strcmp (key, DEFAULT_APPS_KEY_HTTP_NEEDS_TERM) == 0) {
215
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (capplet->web_browser_terminal_checkbutton),
216
- gconf_value_get_bool (value));
218
- cs = gconf_change_set_new ();
220
- gconf_change_set_set (cs, DEFAULT_APPS_KEY_HTTPS_NEEDS_TERM, value);
221
- gconf_change_set_set (cs, DEFAULT_APPS_KEY_UNKNOWN_NEEDS_TERM, value);
222
- gconf_change_set_set (cs, DEFAULT_APPS_KEY_ABOUT_NEEDS_TERM, value);
223
- gconf_change_set_set (cs, DEFAULT_APPS_KEY_BROWSER_NEEDS_TERM, value);
225
- gconf_client_commit_change_set (capplet->gconf, cs, TRUE, &error);
227
- if (error != NULL) {
228
- g_warning (_("Error saving configuration: %s"), error->message);
229
- g_error_free (error);
233
- gconf_change_set_unref (cs);
238
-web_browser_update_radio_buttons (GnomeDACapplet *capplet, const gchar *command)
241
- gboolean has_net_remote;
243
- entry = g_list_find_custom (capplet->web_browsers, command, (GCompareFunc) web_item_comp);
246
- GnomeDAWebItem *item = (GnomeDAWebItem *) entry->data;
248
- has_net_remote = item->netscape_remote;
250
- if (has_net_remote) {
251
- /* disable "toggle" signal emitting, thus preventing calling this function twice */
252
- g_signal_handlers_block_matched (capplet->default_radiobutton, G_SIGNAL_MATCH_FUNC, 0,
253
- 0, NULL, G_CALLBACK (web_radiobutton_toggled_cb), NULL);
254
- g_signal_handlers_block_matched (capplet->new_tab_radiobutton, G_SIGNAL_MATCH_FUNC, 0,
255
- 0, NULL, G_CALLBACK (web_radiobutton_toggled_cb), NULL);
256
- g_signal_handlers_block_matched (capplet->new_win_radiobutton,G_SIGNAL_MATCH_FUNC, 0,
257
- 0, NULL, G_CALLBACK (web_radiobutton_toggled_cb), NULL);
259
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (capplet->default_radiobutton),
260
- strcmp (item->generic.command, command) == 0);
261
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (capplet->new_tab_radiobutton),
262
- strcmp (item->tab_command, command) == 0);
263
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (capplet->new_win_radiobutton),
264
- strcmp (item->win_command, command) == 0);
266
- g_signal_handlers_unblock_matched (capplet->default_radiobutton, G_SIGNAL_MATCH_FUNC, 0,
267
- 0, NULL, G_CALLBACK (web_radiobutton_toggled_cb), NULL);
268
- g_signal_handlers_unblock_matched (capplet->new_tab_radiobutton, G_SIGNAL_MATCH_FUNC, 0,
269
- 0, NULL, G_CALLBACK (web_radiobutton_toggled_cb), NULL);
270
- g_signal_handlers_unblock_matched (capplet->new_win_radiobutton, G_SIGNAL_MATCH_FUNC, 0,
271
- 0, NULL, G_CALLBACK (web_radiobutton_toggled_cb), NULL);
275
- has_net_remote = FALSE;
278
- gtk_widget_set_sensitive (capplet->default_radiobutton, has_net_remote);
279
- gtk_widget_set_sensitive (capplet->new_win_radiobutton, has_net_remote);
280
- gtk_widget_set_sensitive (capplet->new_tab_radiobutton, has_net_remote);
284
-web_combo_conv_to_widget (GConfPropertyEditor *peditor, const GConfValue *value)
287
- GList *entry, *handlers;
288
- const gchar *command;
290
- GnomeDACapplet *capplet;
292
- g_object_get (G_OBJECT (peditor), "data", &capplet, NULL);
294
- command = gconf_value_get_string (value);
295
- handlers = capplet->web_browsers;
299
- entry = g_list_find_custom (handlers, command, (GCompareFunc) web_item_comp);
301
- index = g_list_position (handlers, entry);
303
- index = g_list_length (handlers) + 1;
307
- /* if the item has no handlers lsit then select the Custom item */
311
- web_browser_update_radio_buttons (capplet, command);
313
- ret = gconf_value_new (GCONF_VALUE_INT);
314
- gconf_value_set_int (ret, index);
320
-web_combo_conv_from_widget (GConfPropertyEditor *peditor, const GConfValue *value)
325
- GnomeDAWebItem *item;
326
- const gchar *command;
327
- GnomeDACapplet *capplet;
329
- g_object_get (G_OBJECT (peditor), "data", &capplet, NULL);
331
- index = gconf_value_get_int (value);
332
- handlers = capplet->web_browsers;
334
- item = g_list_nth_data (handlers, index);
336
- ret = gconf_value_new (GCONF_VALUE_STRING);
339
- /* if item was not found, this is probably the "Custom" item */
340
- /* XXX: returning "" as the value here is not ideal, but required to
341
- * prevent the combo box from jumping back to the previous value if the
342
- * user has selected Custom */
343
- gconf_value_set_string (ret, "");
348
- if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (capplet->new_win_radiobutton)) && item->netscape_remote == TRUE)
349
- command = item->win_command;
350
- else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (capplet->new_tab_radiobutton)) && item->netscape_remote == TRUE)
351
- command = item->tab_command;
353
- command = item->generic.command;
355
- gconf_value_set_string (ret, command);
361
combo_conv_to_widget (GConfPropertyEditor *peditor, const GConfValue *value)
367
-fill_combo_box (GtkIconTheme *theme, GtkComboBox *combo_box, GList *app_list)
368
+fill_combo_box (GtkIconTheme *theme, GtkComboBox *combo_box, GList *app_list, gboolean add_custom)
373
theme = gtk_icon_theme_get_default ();
376
- gtk_combo_box_set_row_separator_func (combo_box, is_separator,
377
- GINT_TO_POINTER (g_list_length (app_list)), NULL);
379
+ gtk_combo_box_set_row_separator_func (combo_box, is_separator,
380
+ GINT_TO_POINTER (g_list_length (app_list)), NULL);
383
model = GTK_TREE_MODEL (gtk_list_store_new (2, GDK_TYPE_PIXBUF, G_TYPE_STRING));
384
gtk_combo_box_set_model (combo_box, model);
385
@@ -683,13 +422,15 @@
386
g_object_unref (pixbuf);
389
- gtk_list_store_append (GTK_LIST_STORE (model), &iter);
390
- gtk_list_store_set (GTK_LIST_STORE (model), &iter, -1);
391
- gtk_list_store_append (GTK_LIST_STORE (model), &iter);
392
- gtk_list_store_set (GTK_LIST_STORE (model), &iter,
394
- TEXT_COL, _("Custom"),
397
+ gtk_list_store_append (GTK_LIST_STORE (model), &iter);
398
+ gtk_list_store_set (GTK_LIST_STORE (model), &iter, -1);
399
+ gtk_list_store_append (GTK_LIST_STORE (model), &iter);
400
+ gtk_list_store_set (GTK_LIST_STORE (model), &iter,
402
+ TEXT_COL, _("Custom"),
409
capplet->window = _gtk_builder_get_widget (builder,"preferred_apps_dialog");
410
g_signal_connect (capplet->window, "response", G_CALLBACK (close_cb), NULL);
412
- capplet->web_browser_command_entry = _gtk_builder_get_widget (builder, "web_browser_command_entry");
413
- capplet->web_browser_command_label = _gtk_builder_get_widget (builder, "web_browser_command_label");
414
- capplet->web_browser_terminal_checkbutton = _gtk_builder_get_widget(builder, "web_browser_terminal_checkbutton");
415
- capplet->default_radiobutton = _gtk_builder_get_widget (builder, "web_browser_default_radiobutton");
416
- capplet->new_win_radiobutton = _gtk_builder_get_widget (builder, "web_browser_new_win_radiobutton");
417
- capplet->new_tab_radiobutton = _gtk_builder_get_widget (builder, "web_browser_new_tab_radiobutton");
419
- capplet->mail_reader_command_entry = _gtk_builder_get_widget (builder, "mail_reader_command_entry");
420
- capplet->mail_reader_command_label = _gtk_builder_get_widget (builder, "mail_reader_command_label");
421
- capplet->mail_reader_terminal_checkbutton = _gtk_builder_get_widget (builder, "mail_reader_terminal_checkbutton");
423
capplet->terminal_command_entry = _gtk_builder_get_widget (builder, "terminal_command_entry");
424
capplet->terminal_command_label = _gtk_builder_get_widget (builder, "terminal_command_label");
425
capplet->terminal_exec_flag_entry = _gtk_builder_get_widget (builder, "terminal_exec_flag_entry");
426
@@ -770,12 +500,12 @@
427
g_signal_connect (capplet->window, "screen-changed", G_CALLBACK (screen_changed_cb), capplet);
428
screen_changed_cb (capplet->window, gdk_screen_get_default (), capplet);
430
- fill_combo_box (capplet->icon_theme, GTK_COMBO_BOX (capplet->web_combo_box), capplet->web_browsers);
431
- fill_combo_box (capplet->icon_theme, GTK_COMBO_BOX (capplet->mail_combo_box), capplet->mail_readers);
432
- fill_combo_box (capplet->icon_theme, GTK_COMBO_BOX (capplet->term_combo_box), capplet->terminals);
433
- fill_combo_box (capplet->icon_theme, GTK_COMBO_BOX (capplet->media_combo_box), capplet->media_players);
434
- fill_combo_box (capplet->icon_theme, GTK_COMBO_BOX (capplet->visual_combo_box), capplet->visual_ats);
435
- fill_combo_box (capplet->icon_theme, GTK_COMBO_BOX (capplet->mobility_combo_box), capplet->mobility_ats);
436
+ fill_combo_box (capplet->icon_theme, GTK_COMBO_BOX (capplet->web_combo_box), capplet->web_browsers, FALSE);
437
+ fill_combo_box (capplet->icon_theme, GTK_COMBO_BOX (capplet->mail_combo_box), capplet->mail_readers, FALSE);
438
+ fill_combo_box (capplet->icon_theme, GTK_COMBO_BOX (capplet->term_combo_box), capplet->terminals, TRUE);
439
+ fill_combo_box (capplet->icon_theme, GTK_COMBO_BOX (capplet->media_combo_box), capplet->media_players, TRUE);
440
+ fill_combo_box (capplet->icon_theme, GTK_COMBO_BOX (capplet->visual_combo_box), capplet->visual_ats, TRUE);
441
+ fill_combo_box (capplet->icon_theme, GTK_COMBO_BOX (capplet->mobility_combo_box), capplet->mobility_ats, TRUE);
443
g_signal_connect (capplet->web_combo_box, "changed", G_CALLBACK (web_combo_changed_cb), capplet);
444
g_signal_connect (capplet->mail_combo_box, "changed", G_CALLBACK (mail_combo_changed_cb), capplet);
446
g_signal_connect (capplet->visual_combo_box, "changed", G_CALLBACK (visual_combo_changed_cb), capplet);
447
g_signal_connect (capplet->mobility_combo_box, "changed", G_CALLBACK (mobility_combo_changed_cb), capplet);
450
- g_signal_connect (capplet->default_radiobutton, "toggled", G_CALLBACK (web_radiobutton_toggled_cb), capplet);
451
- g_signal_connect (capplet->new_win_radiobutton, "toggled", G_CALLBACK (web_radiobutton_toggled_cb), capplet);
452
- g_signal_connect (capplet->new_tab_radiobutton, "toggled", G_CALLBACK (web_radiobutton_toggled_cb), capplet);
454
/* Setup GConfPropertyEditors */
457
- gconf_peditor_new_combo_box (NULL,
458
- DEFAULT_APPS_KEY_HTTP_EXEC,
459
- capplet->web_combo_box,
460
- "conv-from-widget-cb", web_combo_conv_from_widget,
461
- "conv-to-widget-cb", web_combo_conv_to_widget,
465
- obj = gconf_peditor_new_string (NULL,
466
- DEFAULT_APPS_KEY_HTTP_EXEC,
467
- capplet->web_browser_command_entry,
469
- g_signal_connect (obj, "value-changed", G_CALLBACK (web_gconf_changed_cb), capplet);
471
- obj = gconf_peditor_new_boolean (NULL,
472
- DEFAULT_APPS_KEY_HTTP_NEEDS_TERM,
473
- capplet->web_browser_terminal_checkbutton,
475
- g_signal_connect (obj, "value-changed", G_CALLBACK (web_gconf_changed_cb), capplet);
478
- gconf_peditor_new_combo_box (NULL,
479
- DEFAULT_APPS_KEY_MAILER_EXEC,
480
- capplet->mail_combo_box,
481
- "conv-from-widget-cb", combo_conv_from_widget,
482
- "conv-to-widget-cb", combo_conv_to_widget,
483
- "data", capplet->mail_readers,
486
- gconf_peditor_new_string (NULL,
487
- DEFAULT_APPS_KEY_MAILER_EXEC,
488
- capplet->mail_reader_command_entry,
491
- gconf_peditor_new_boolean (NULL,
492
- DEFAULT_APPS_KEY_MAILER_NEEDS_TERM,
493
- capplet->mail_reader_terminal_checkbutton,
497
gconf_peditor_new_combo_box (NULL,
498
DEFAULT_APPS_KEY_MEDIA_EXEC,
499
Index: gnome-control-center-2.32.1/capplets/default-applications/gnome-da-capplet.h
500
===================================================================
501
--- gnome-control-center-2.32.1.orig/capplets/default-applications/gnome-da-capplet.h 2011-01-05 12:44:35.389640504 -0500
502
+++ gnome-control-center-2.32.1/capplets/default-applications/gnome-da-capplet.h 2011-01-05 16:04:48.714315795 -0500
504
GtkWidget *visual_combo_box;
505
GtkWidget *mobility_combo_box;
507
- GtkWidget *web_browser_command_entry;
508
- GtkWidget *web_browser_command_label;
509
- GtkWidget *web_browser_terminal_checkbutton;
510
- GtkWidget *default_radiobutton;
511
- GtkWidget *new_win_radiobutton;
512
- GtkWidget *new_tab_radiobutton;
514
- GtkWidget *mail_reader_command_entry;
515
- GtkWidget *mail_reader_command_label;
516
- GtkWidget *mail_reader_terminal_checkbutton;
518
GtkWidget *terminal_command_entry;
519
GtkWidget *terminal_command_label;
520
GtkWidget *terminal_exec_flag_entry;
522
GList *media_players;
526
+ guint theme_changed_id;
530
Index: gnome-control-center-2.32.1/capplets/default-applications/gnome-da-item.c
531
===================================================================
532
--- gnome-control-center-2.32.1.orig/capplets/default-applications/gnome-da-item.c 2011-01-05 12:44:35.329641056 -0500
533
+++ gnome-control-center-2.32.1/capplets/default-applications/gnome-da-item.c 2011-01-05 16:04:48.644316418 -0500
535
#include "gnome-da-capplet.h"
536
#include "gnome-da-item.h"
539
-gnome_da_web_item_new (void)
541
+gnome_da_url_item_new (void)
543
- GnomeDAWebItem *item = NULL;
544
+ GnomeDAURLItem *item = NULL;
546
- item = g_new0 (GnomeDAWebItem, 1);
547
+ item = g_new0 (GnomeDAURLItem, 1);
555
-gnome_da_web_item_free (GnomeDAWebItem *item)
556
+gnome_da_url_item_free (GnomeDAURLItem *item)
558
g_return_if_fail (item != NULL);
561
g_free (item->generic.icon_name);
562
g_free (item->generic.icon_path);
564
- g_free (item->tab_command);
565
- g_free (item->win_command);
566
+ g_object_unref (item->app_info);
570
Index: gnome-control-center-2.32.1/capplets/default-applications/gnome-da-item.h
571
===================================================================
572
--- gnome-control-center-2.32.1.orig/capplets/default-applications/gnome-da-item.h 2011-01-05 12:44:35.369640688 -0500
573
+++ gnome-control-center-2.32.1/capplets/default-applications/gnome-da-item.h 2011-01-05 16:04:48.684316062 -0500
576
typedef struct _GnomeDAItem GnomeDAItem;
578
-typedef struct _GnomeDAWebItem GnomeDAWebItem;
579
+typedef struct _GnomeDAURLItem GnomeDAURLItem;
580
typedef struct _GnomeDATermItem GnomeDATermItem;
581
typedef struct _GnomeDASimpleItem GnomeDASimpleItem;
582
typedef struct _GnomeDAVisualItem GnomeDAVisualItem;
587
-struct _GnomeDAWebItem {
588
+struct _GnomeDASimpleItem {
590
gboolean run_in_terminal;
591
- gboolean netscape_remote;
592
- gchar *tab_command;
593
- gchar *win_command;
596
-struct _GnomeDASimpleItem {
597
+struct _GnomeDAURLItem {
599
- gboolean run_in_terminal;
600
+ GAppInfo *app_info;
603
struct _GnomeDATermItem {
605
gboolean run_at_startup;
608
-GnomeDAWebItem* gnome_da_web_item_new (void);
609
GnomeDATermItem* gnome_da_term_item_new (void);
610
+GnomeDAURLItem* gnome_da_url_item_new (void);
611
GnomeDASimpleItem* gnome_da_simple_item_new (void);
612
GnomeDAVisualItem* gnome_da_visual_item_new (void);
613
GnomeDAMobilityItem* gnome_da_mobility_item_new (void);
614
-void gnome_da_web_item_free (GnomeDAWebItem *item);
615
void gnome_da_term_item_free (GnomeDATermItem *item);
616
+void gnome_da_url_item_free (GnomeDAURLItem *item);
617
void gnome_da_simple_item_free (GnomeDASimpleItem *item);
618
void gnome_da_visual_item_free (GnomeDAVisualItem *item);
619
void gnome_da_mobility_item_free (GnomeDAMobilityItem *item);
620
Index: gnome-control-center-2.32.1/capplets/default-applications/gnome-da-xml.c
621
===================================================================
622
--- gnome-control-center-2.32.1.orig/capplets/default-applications/gnome-da-xml.c 2011-01-05 12:44:35.319641148 -0500
623
+++ gnome-control-center-2.32.1/capplets/default-applications/gnome-da-xml.c 2011-01-05 16:04:48.624316596 -0500
625
if (!xmlStrncmp (element->name, xml_val_name, len)) {
626
xmlChar *cont = xmlNodeGetContent (element);
628
- if (!xmlStrcasecmp (cont, "true") || !xmlStrcasecmp (cont, "1"))
629
+ if (!xmlStrcasecmp (cont, (const xmlChar *) "true") || !xmlStrcasecmp (cont, (const xmlChar *) "1"))
636
for (i = 0; sys_langs[i] != NULL; i++) {
637
- if (!strcmp (sys_langs[i], node_lang)) {
638
+ if (!strcmp ((const char *) sys_langs[i], (const char *) node_lang)) {
639
ret_val = (gchar *) xmlNodeGetContent (element);
640
/* since sys_langs is sorted from most desirable to
641
* least desirable, exit at first match
646
-is_executable_valid (gchar *executable)
647
+is_executable_valid (const gchar *executable)
653
xmlNode *root, *section, *element;
655
- GnomeDAWebItem *web_item;
656
- GnomeDASimpleItem *mail_item;
657
GnomeDASimpleItem *media_item;
658
GnomeDATermItem *term_item;
659
GnomeDAVisualItem *visual_item;
661
root = xmlDocGetRootElement (xml_doc);
663
for (section = root->children; section != NULL; section = section->next) {
664
- if (!xmlStrncmp (section->name, "web-browsers", 12)) {
665
- for (element = section->children; element != NULL; element = element->next) {
666
- if (!xmlStrncmp (element->name, "web-browser", 11)) {
667
- executable = gnome_da_xml_get_string (element, "executable");
668
- if (is_executable_valid (executable)) {
669
- web_item = gnome_da_web_item_new ();
671
- web_item->generic.name = gnome_da_xml_get_string (element, "name");
672
- web_item->generic.executable = executable;
673
- web_item->generic.command = gnome_da_xml_get_string (element, "command");
674
- web_item->generic.icon_name = gnome_da_xml_get_string (element, "icon-name");
676
- web_item->run_in_terminal = gnome_da_xml_get_bool (element, "run-in-terminal");
677
- web_item->netscape_remote = gnome_da_xml_get_bool (element, "netscape-remote");
678
- if (web_item->netscape_remote) {
679
- web_item->tab_command = gnome_da_xml_get_string (element, "tab-command");
680
- web_item->win_command = gnome_da_xml_get_string (element, "win-command");
683
- capplet->web_browsers = g_list_append (capplet->web_browsers, web_item);
686
- g_free (executable);
690
- else if (!xmlStrncmp (section->name, "mail-readers", 12)) {
691
- for (element = section->children; element != NULL; element = element->next) {
692
- if (!xmlStrncmp (element->name, "mail-reader", 11)) {
693
- executable = gnome_da_xml_get_string (element, "executable");
694
- if (is_executable_valid (executable)) {
695
- mail_item = gnome_da_simple_item_new ();
697
- mail_item->generic.name = gnome_da_xml_get_string (element, "name");
698
- mail_item->generic.executable = executable;
699
- mail_item->generic.command = gnome_da_xml_get_string (element, "command");
700
- mail_item->generic.icon_name = gnome_da_xml_get_string (element, "icon-name");
702
- mail_item->run_in_terminal = gnome_da_xml_get_bool (element, "run-in-terminal");
704
- capplet->mail_readers = g_list_append (capplet->mail_readers, mail_item);
707
- g_free (executable);
711
- else if (!xmlStrncmp (section->name, "terminals", 9)) {
712
- for (element = section->children; element != NULL; element = element->next) {
713
- if (!xmlStrncmp (element->name, "terminal", 8)) {
714
+ if (!xmlStrncmp (section->name, (const xmlChar *) "terminals", 9)) {
715
+ for (element = section->children; element != NULL; element = element->next) {
716
+ if (!xmlStrncmp (element->name, (const xmlChar *) "terminal", 8)) {
717
executable = gnome_da_xml_get_string (element, "executable");
718
if (is_executable_valid (executable)) {
719
term_item = gnome_da_term_item_new ();
720
@@ -209,12 +160,12 @@
728
- else if (!xmlStrncmp (section->name, "media-players", 13)) {
730
+ else if (!xmlStrncmp (section->name, (const xmlChar *) "media-players", 13)) {
731
for (element = section->children; element != NULL; element = element->next) {
732
- if (!xmlStrncmp (element->name, "media-player", 12)) {
733
+ if (!xmlStrncmp (element->name, (const xmlChar *) "media-player", 12)) {
734
executable = gnome_da_xml_get_string (element, "executable");
735
if (is_executable_valid (executable)) {
736
media_item = gnome_da_simple_item_new ();
737
@@ -232,10 +183,10 @@
742
- else if (!xmlStrncmp (section->name, "a11y-visual", 11)) {
744
+ else if (!xmlStrncmp (section->name, (const xmlChar *) "a11y-visual", 11)) {
745
for (element = section->children; element != NULL; element = element->next) {
746
- if (!xmlStrncmp (element->name, "visual", 6)) {
747
+ if (!xmlStrncmp (element->name, (const xmlChar *) "visual", 6)) {
748
executable = gnome_da_xml_get_string (element,"executable");
749
if (is_executable_valid (executable)) {
750
visual_item = gnome_da_visual_item_new ();
751
@@ -253,10 +204,10 @@
756
- else if (!xmlStrncmp (section->name, "a11y-mobility", 13)) {
758
+ else if (!xmlStrncmp (section->name, (const xmlChar *) "a11y-mobility", 13)) {
759
for (element = section->children; element != NULL; element = element->next) {
760
- if (!xmlStrncmp (element->name, "mobility", 8)) {
761
+ if (!xmlStrncmp (element->name, (const xmlChar *) "mobility", 8)) {
762
executable = gnome_da_xml_get_string (element,"executable");
763
if (is_executable_valid (executable)) {
764
mobility_item = gnome_da_mobility_item_new ();
765
@@ -274,17 +225,52 @@
773
xmlFreeDoc (xml_doc);
777
+load_url_handlers (GnomeDACapplet *capplet, const gchar *scheme)
779
+ GList *app_list, *l, *ret;
781
+ app_list = g_app_info_get_all_for_type (scheme);
784
+ for (l = app_list; l != NULL; l = l->next) {
785
+ const gchar *executable;
786
+ GAppInfo *app_info = l->data;
788
+ executable = g_app_info_get_executable (app_info);
789
+ if (is_executable_valid (executable)) {
790
+ GnomeDAURLItem *url_item;
792
+ url_item = gnome_da_url_item_new ();
793
+ url_item->generic.name = g_strdup (g_app_info_get_display_name (app_info));
794
+ url_item->generic.executable = g_strdup (executable);
795
+ url_item->generic.command = g_strdup (g_app_info_get_commandline (app_info));
796
+ url_item->generic.icon_name = g_strdup (g_app_info_get_name (app_info));
797
+ /* Steal the reference */
798
+ url_item->app_info = app_info;
800
+ ret = g_list_prepend (ret, url_item);
802
+ g_object_unref (app_info);
805
+ g_list_free (app_list);
807
+ return g_list_reverse (ret);
811
gnome_da_xml_load_list (GnomeDACapplet *capplet)
813
GDir *app_dir = g_dir_open (GNOMECC_APPS_DIR, 0, NULL);
815
+ /* First load all applications from the XML files */
816
if (app_dir != NULL) {
817
const gchar *extra_file;
819
@@ -299,13 +285,17 @@
821
g_dir_close (app_dir);
824
+ /* Now load URL handlers */
825
+ capplet->web_browsers = load_url_handlers (capplet, "x-scheme-handler/http");
826
+ capplet->mail_readers = load_url_handlers (capplet, "x-scheme-handler/mailto");
830
gnome_da_xml_free (GnomeDACapplet *capplet)
832
- g_list_foreach (capplet->web_browsers, (GFunc) gnome_da_web_item_free, NULL);
833
- g_list_foreach (capplet->mail_readers, (GFunc) gnome_da_simple_item_free, NULL);
834
+ g_list_foreach (capplet->web_browsers, (GFunc) gnome_da_url_item_free, NULL);
835
+ g_list_foreach (capplet->mail_readers, (GFunc) gnome_da_url_item_free, NULL);
836
g_list_foreach (capplet->terminals, (GFunc) gnome_da_term_item_free, NULL);
837
g_list_foreach (capplet->media_players, (GFunc) gnome_da_simple_item_free, NULL);
838
g_list_foreach (capplet->visual_ats, (GFunc) gnome_da_visual_item_free, NULL);
839
Index: gnome-control-center-2.32.1/capplets/default-applications/gnome-default-applications.xml.in
840
===================================================================
841
--- gnome-control-center-2.32.1.orig/capplets/default-applications/gnome-default-applications.xml.in 2011-01-05 12:44:35.439640047 -0500
842
+++ gnome-control-center-2.32.1/capplets/default-applications/gnome-default-applications.xml.in 2011-01-05 12:49:38.216961619 -0500
845
<!-- Remember to never use the same string for <command>, <tab-command> and <win-command> entries -->
849
- <_name>Opera</_name>
850
- <executable>opera</executable>
851
- <command>opera %s</command>
852
- <icon-name>opera</icon-name>
853
- <run-in-terminal>false</run-in-terminal>
854
- <netscape-remote>true</netscape-remote>
855
- <tab-command>opera -newpage %s</tab-command>
856
- <win-command>opera -newwindow %s</win-command>
859
- <_name>Epiphany Web Browser</_name>
860
- <executable>epiphany</executable>
861
- <command>epiphany %s</command>
862
- <icon-name>web-browser</icon-name>
863
- <run-in-terminal>false</run-in-terminal>
864
- <netscape-remote>true</netscape-remote>
865
- <tab-command>epiphany --new-tab %s</tab-command>
866
- <win-command>epiphany --new-window %s</win-command>
869
- <_name>Galeon</_name>
870
- <executable>galeon</executable>
871
- <command>galeon %s</command>
872
- <icon-name>galeon</icon-name>
873
- <run-in-terminal>false</run-in-terminal>
874
- <netscape-remote>true</netscape-remote>
875
- <tab-command>galeon -n %s</tab-command>
876
- <win-command>galeon -w %s</win-command>
879
- <_name>Encompass</_name>
880
- <executable>encompass</executable>
881
- <command>encompass %s</command>
882
- <icon-name>encompass</icon-name>
883
- <run-in-terminal>false</run-in-terminal>
884
- <netscape-remote>false</netscape-remote>
887
- <_name>Firebird</_name>
888
- <executable>mozilla-firebird</executable>
889
- <command>mozilla-firebird %s</command>
890
- <icon-name></icon-name>
891
- <run-in-terminal>false</run-in-terminal>
892
- <netscape-remote>true</netscape-remote>
893
- <tab-command>mozilla-firebird -remote "openurl(%s,new-tab)"</tab-command>
894
- <win-command>mozilla-firebird -remote "openurl(%s,new-window)"</win-command>
897
- <_name>Firefox</_name>
898
- <executable>firefox</executable>
899
- <command>firefox %s</command>
900
- <icon-name>firefox</icon-name>
901
- <run-in-terminal>false</run-in-terminal>
902
- <netscape-remote>true</netscape-remote>
903
- <tab-command>firefox -new-tab "%s"</tab-command>
904
- <win-command>firefox -new-window "%s"</win-command>
907
- <_name>Iceweasel</_name>
908
- <executable>iceweasel</executable>
909
- <command>iceweasel %s</command>
910
- <icon-name>iceweasel</icon-name>
911
- <run-in-terminal>false</run-in-terminal>
912
- <netscape-remote>true</netscape-remote>
913
- <tab-command>iceweasel -new-tab "%s"</tab-command>
914
- <win-command>iceweasel -new-window "%s"</win-command>
917
- <_name>SeaMonkey</_name>
918
- <executable>seamonkey</executable>
919
- <command>seamonkey %s</command>
920
- <icon-name>seamonkey</icon-name>
921
- <run-in-terminal>false</run-in-terminal>
922
- <netscape-remote>true</netscape-remote>
923
- <tab-command>seamonkey -remote "openurl(%s,new-tab)"</tab-command>
924
- <win-command>seamonkey -remote "openurl(%s,new-window)"</win-command>
927
- <_name>Iceape</_name>
928
- <executable>iceape</executable>
929
- <command>iceape %s</command>
930
- <icon-name>iceape</icon-name>
931
- <run-in-terminal>false</run-in-terminal>
932
- <netscape-remote>true</netscape-remote>
933
- <tab-command>iceape -remote "openurl(%s,new-tab)"</tab-command>
934
- <win-command>iceape -remote "openurl(%s,new-window)"</win-command>
937
- <_name>Netscape Communicator</_name>
938
- <executable>netscape</executable>
939
- <command>netscape %s</command>
940
- <icon-name>netscape</icon-name>
941
- <run-in-terminal>false</run-in-terminal>
942
- <netscape-remote>true</netscape-remote>
943
- <tab-command>netscape -remote "openurl(%s,new-tab)"</tab-command>
944
- <win-command>netscape -remote "openurl(%s,new-window)"</win-command>
947
- <_name>Konqueror</_name>
948
- <executable>konqueror</executable>
949
- <command>konqueror %s</command>
950
- <icon-name>konqueror</icon-name>
951
- <run-in-terminal>false</run-in-terminal>
952
- <netscape-remote>false</netscape-remote>
955
- <_name>Midori</_name>
956
- <executable>midori</executable>
957
- <command>midori %s</command>
958
- <icon-name>midori</icon-name>
959
- <run-in-terminal>false</run-in-terminal>
960
- <netscape-remote>false</netscape-remote>
966
- <_name>Evolution Mail Reader</_name>
967
- <executable>evolution</executable>
968
- <command>evolution %s</command>
969
- <icon-name>evolution</icon-name>
970
- <run-in-terminal>false</run-in-terminal>
973
- <_name>Balsa</_name>
974
- <executable>balsa</executable>
975
- <command>balsa -m %s</command>
976
- <icon-name>gnome-balsa2</icon-name>
977
- <run-in-terminal>false</run-in-terminal>
980
- <_name>KMail</_name>
981
- <executable>kmail</executable>
982
- <command>kmail %s</command>
983
- <icon-name>kmail</icon-name>
984
- <run-in-terminal>false</run-in-terminal>
987
- <_name>Icedove</_name>
988
- <executable>icedove</executable>
989
- <command>icedove %s</command>
990
- <icon-name>icedove</icon-name>
991
- <run-in-terminal>false</run-in-terminal>
994
- <_name>Thunderbird</_name>
995
- <executable>thunderbird</executable>
996
- <command>thunderbird %s</command>
997
- <icon-name>thunderbird</icon-name>
998
- <run-in-terminal>false</run-in-terminal>
1001
- <_name>Mozilla Thunderbird</_name>
1002
- <executable>mozilla-thunderbird</executable>
1003
- <command>mozilla-thunderbird %s</command>
1004
- <icon-name>thunderbird</icon-name>
1005
- <run-in-terminal>false</run-in-terminal>
1008
- <_name>SeaMonkey Mail</_name>
1009
- <executable>seamonkey</executable>
1010
- <command>seamonkey -mail %s</command>
1011
- <icon-name>seamonkey</icon-name>
1012
- <run-in-terminal>false</run-in-terminal>
1015
- <_name>Iceape Mail</_name>
1016
- <executable>iceape</executable>
1017
- <command>iceape -mail %s</command>
1018
- <icon-name>iceape</icon-name>
1019
- <run-in-terminal>false</run-in-terminal>
1022
- <_name>Mutt</_name>
1023
- <executable>mutt</executable>
1024
- <command>mutt %s</command>
1025
- <icon-name>gnome-mime-application-x-executable</icon-name>
1026
- <run-in-terminal>true</run-in-terminal>
1029
- <_name>Claws Mail</_name>
1030
- <executable>claws-mail</executable>
1031
- <command>claws-mail --compose %s</command>
1032
- <icon-name>claws-mail</icon-name>
1033
- <run-in-terminal>false</run-in-terminal>
1036
- <_name>Sylpheed-Claws</_name>
1037
- <executable>sylpheed-claws</executable>
1038
- <command>sylpheed-claws --compose %s</command>
1039
- <icon-name>sylpheed</icon-name>
1040
- <run-in-terminal>false</run-in-terminal>
1043
- <_name>Sylpheed</_name>
1044
- <executable>sylpheed</executable>
1045
- <command>sylpheed --compose %s</command>
1046
- <icon-name>sylpheed</icon-name>
1047
- <run-in-terminal>false</run-in-terminal>
1053
<_name>GNOME Terminal</_name>
1054
Index: gnome-control-center-2.32.1/capplets/default-applications/gnome-default-applications-properties.ui
1055
===================================================================
1056
--- gnome-control-center-2.32.1.orig/capplets/default-applications/gnome-default-applications-properties.ui 2011-01-05 12:55:22.733917635 -0500
1057
+++ gnome-control-center-2.32.1/capplets/default-applications/gnome-default-applications-properties.ui 2011-01-05 12:55:26.903881280 -0500
1062
- <object class="GtkTable" id="web_browser_options_table">
1063
- <property name="visible">True</property>
1064
- <property name="n_rows">4</property>
1065
- <property name="n_columns">3</property>
1066
- <property name="column_spacing">12</property>
1067
- <property name="row_spacing">6</property>
1069
- <object class="GtkEntry" id="web_browser_command_entry">
1070
- <property name="visible">True</property>
1071
- <property name="can_focus">True</property>
1072
- <property name="tooltip_text" translatable="yes">All %s occurrences will be replaced with actual link</property>
1075
- <property name="left_attach">1</property>
1076
- <property name="right_attach">2</property>
1077
- <property name="top_attach">3</property>
1078
- <property name="bottom_attach">4</property>
1079
- <property name="y_options"></property>
1083
- <object class="GtkCheckButton" id="web_browser_terminal_checkbutton">
1084
- <property name="label" translatable="yes">Run in t_erminal</property>
1085
- <property name="visible">True</property>
1086
- <property name="sensitive">False</property>
1087
- <property name="can_focus">True</property>
1088
- <property name="receives_default">False</property>
1089
- <property name="use_underline">True</property>
1090
- <property name="draw_indicator">True</property>
1093
- <property name="left_attach">2</property>
1094
- <property name="right_attach">3</property>
1095
- <property name="top_attach">3</property>
1096
- <property name="bottom_attach">4</property>
1097
- <property name="x_options">GTK_FILL</property>
1098
- <property name="y_options"></property>
1102
- <object class="GtkRadioButton" id="web_browser_default_radiobutton">
1103
- <property name="label" translatable="yes">Open link with web browser _default</property>
1104
- <property name="visible">True</property>
1105
- <property name="sensitive">False</property>
1106
- <property name="can_focus">True</property>
1107
- <property name="receives_default">False</property>
1108
- <property name="use_underline">True</property>
1109
- <property name="active">True</property>
1110
- <property name="draw_indicator">True</property>
1113
- <property name="right_attach">3</property>
1114
- <property name="x_options">GTK_FILL</property>
1115
- <property name="y_options"></property>
1119
- <object class="GtkRadioButton" id="web_browser_new_tab_radiobutton">
1120
- <property name="label" translatable="yes">Open link in new _tab</property>
1121
- <property name="visible">True</property>
1122
- <property name="sensitive">False</property>
1123
- <property name="can_focus">True</property>
1124
- <property name="receives_default">False</property>
1125
- <property name="use_underline">True</property>
1126
- <property name="draw_indicator">True</property>
1127
- <property name="group">web_browser_default_radiobutton</property>
1130
- <property name="right_attach">3</property>
1131
- <property name="top_attach">2</property>
1132
- <property name="bottom_attach">3</property>
1133
- <property name="x_options">GTK_FILL</property>
1134
- <property name="y_options"></property>
1138
- <object class="GtkRadioButton" id="web_browser_new_win_radiobutton">
1139
- <property name="label" translatable="yes">Open link in new _window</property>
1140
- <property name="visible">True</property>
1141
- <property name="sensitive">False</property>
1142
- <property name="can_focus">True</property>
1143
- <property name="receives_default">False</property>
1144
- <property name="use_underline">True</property>
1145
- <property name="draw_indicator">True</property>
1146
- <property name="group">web_browser_default_radiobutton</property>
1149
- <property name="right_attach">3</property>
1150
- <property name="top_attach">1</property>
1151
- <property name="bottom_attach">2</property>
1152
- <property name="x_options">GTK_FILL</property>
1153
- <property name="y_options"></property>
1157
- <object class="GtkLabel" id="web_browser_command_label">
1158
- <property name="visible">True</property>
1159
- <property name="sensitive">False</property>
1160
- <property name="xalign">0</property>
1161
- <property name="label" translatable="yes">C_ommand:</property>
1162
- <property name="use_underline">True</property>
1163
- <property name="mnemonic_widget">web_browser_command_entry</property>
1166
- <property name="top_attach">3</property>
1167
- <property name="bottom_attach">4</property>
1168
- <property name="x_options">GTK_FILL</property>
1169
- <property name="y_options"></property>
1174
- <property name="expand">False</property>
1175
- <property name="fill">False</property>
1176
- <property name="position">1</property>
1182
@@ -249,58 +134,7 @@
1186
- <object class="GtkTable" id="mail_reader_options_table">
1187
- <property name="visible">True</property>
1188
- <property name="n_columns">3</property>
1189
- <property name="column_spacing">12</property>
1190
- <property name="row_spacing">6</property>
1192
- <object class="GtkLabel" id="mail_reader_command_label">
1193
- <property name="visible">True</property>
1194
- <property name="sensitive">False</property>
1195
- <property name="xalign">0</property>
1196
- <property name="label" translatable="yes">Co_mmand:</property>
1197
- <property name="use_underline">True</property>
1198
- <property name="mnemonic_widget">mail_reader_command_entry</property>
1201
- <property name="x_options">GTK_FILL</property>
1202
- <property name="y_options"></property>
1206
- <object class="GtkEntry" id="mail_reader_command_entry">
1207
- <property name="visible">True</property>
1208
- <property name="can_focus">True</property>
1209
- <property name="tooltip_text" translatable="yes">All %s occurrences will be replaced with actual link</property>
1212
- <property name="left_attach">1</property>
1213
- <property name="right_attach">2</property>
1214
- <property name="y_options"></property>
1218
- <object class="GtkCheckButton" id="mail_reader_terminal_checkbutton">
1219
- <property name="label" translatable="yes">Run in t_erminal</property>
1220
- <property name="visible">True</property>
1221
- <property name="sensitive">False</property>
1222
- <property name="can_focus">True</property>
1223
- <property name="receives_default">False</property>
1224
- <property name="use_underline">True</property>
1225
- <property name="draw_indicator">True</property>
1228
- <property name="left_attach">2</property>
1229
- <property name="right_attach">3</property>
1230
- <property name="x_options">GTK_FILL</property>
1231
- <property name="y_options"></property>
1236
- <property name="position">1</property>