summaryrefslogtreecommitdiff
path: root/capplets/default-applications
diff options
context:
space:
mode:
Diffstat (limited to 'capplets/default-applications')
-rw-r--r--capplets/default-applications/mate-da-capplet.c530
-rw-r--r--capplets/default-applications/mate-da-capplet.h12
-rw-r--r--capplets/default-applications/mate-da-item.c180
-rw-r--r--capplets/default-applications/mate-da-item.h112
-rw-r--r--capplets/default-applications/mate-da-xml.c391
-rw-r--r--capplets/default-applications/mate-da-xml.h4
-rw-r--r--capplets/default-applications/mate-default-applications.xml.in40
7 files changed, 741 insertions, 528 deletions
diff --git a/capplets/default-applications/mate-da-capplet.c b/capplets/default-applications/mate-da-capplet.c
index 0f2950c2..8810caec 100644
--- a/capplets/default-applications/mate-da-capplet.c
+++ b/capplets/default-applications/mate-da-capplet.c
@@ -286,6 +286,55 @@ static void mobility_combo_changed_cb(GtkComboBox* combo, MateDACapplet* capplet
gtk_widget_set_sensitive (capplet->mobility_command_label, is_custom_active);
}
+
+static void image_combo_changed_cb(GtkComboBox* combo, MateDACapplet* capplet)
+{
+ guint current_index;
+ gboolean is_custom_active;
+
+ current_index = gtk_combo_box_get_active(combo);
+ is_custom_active = (current_index >= g_list_length(capplet->image_viewers));
+
+ if (current_index != -1)
+ {
+ MateDAItem* item = (MateDAItem*) g_list_nth_data(capplet->image_viewers, current_index);
+
+ if (item != NULL)
+ {
+ /* Para obtener la lista de elementos, y si está en la lista, agregar ese
+ * item.
+ * De lo contrario, se crea un elemento especial. */
+ GList* recommended = g_app_info_get_recommended_for_type("image/png");
+
+ if (recommended!= NULL)
+ {
+ GList* app;
+
+ for (app = recommended; app != NULL; app = app->next)
+ {
+ /* nice hack bro */
+ if (strcmp(item->executable, g_app_info_get_executable((GAppInfo*) app->data)) == 0)
+ {
+ /* por alguna extraña razon, solo se usa mailto, en vez de mail. */
+ g_app_info_set_as_default_for_type((GAppInfo*) app->data, "image/png", NULL);
+ g_app_info_set_as_default_for_type((GAppInfo*) app->data, "image/jpeg", NULL);
+ g_app_info_set_as_default_for_type((GAppInfo*) app->data, "image/gif", NULL);
+ g_app_info_set_as_default_for_type((GAppInfo*) app->data, "image/bmp", NULL);
+ g_app_info_set_as_default_for_type((GAppInfo*) app->data, "image/tiff", NULL);
+ }
+ }
+
+ g_list_free_full(recommended, g_object_unref);
+ }
+ }
+ }
+
+ gtk_widget_set_sensitive(capplet->image_viewer_command_entry, is_custom_active);
+ gtk_widget_set_sensitive(capplet->image_viewer_command_label, is_custom_active);
+ gtk_widget_set_sensitive(capplet->image_viewer_terminal_checkbutton, is_custom_active);
+}
+
+
static void refresh_combo_box_icons(GtkIconTheme* theme, GtkComboBox* combo_box, GList* app_list)
{
GList *entry;
@@ -757,31 +806,34 @@ static void fill_combo_box (GtkIconTheme* theme, GtkComboBox* combo_box, GList*
-1);
}
+/* not used
static GtkWidget* _gtk_builder_get_widget(GtkBuilder* builder, const gchar* name)
{
return GTK_WIDGET(gtk_builder_get_object(builder, name));
-}
+}*/
static void show_dialog(MateDACapplet* capplet, const gchar* start_page)
{
- GObject* obj;
- GtkBuilder* builder;
- guint builder_result;
+ #define get_widget(name) GTK_WIDGET(gtk_builder_get_object(builder, name))
- capplet->builder = builder = gtk_builder_new ();
+ GObject* obj;
+ GtkBuilder* builder;
+ guint builder_result;
- if (g_file_test(MATECC_UI_DIR "/mate-default-applications-properties.ui", G_FILE_TEST_EXISTS) != FALSE)
- {
+ capplet->builder = builder = gtk_builder_new ();
+
+ if (g_file_test(MATECC_UI_DIR "/mate-default-applications-properties.ui", G_FILE_TEST_EXISTS) != FALSE)
+ {
builder_result = gtk_builder_add_from_file(builder, MATECC_UI_DIR "/mate-default-applications-properties.ui", NULL);
- }
- else
- {
+ }
+ else
+ {
builder_result = gtk_builder_add_from_file(builder, "./mate-default-applications-properties.ui", NULL);
- }
+ }
- if (builder_result == 0)
- {
+ if (builder_result == 0)
+ {
GtkWidget* dialog = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, _("Could not load the main interface"));
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), _("Please make sure that the applet is properly installed"));
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
@@ -790,230 +842,254 @@ static void show_dialog(MateDACapplet* capplet, const gchar* start_page)
gtk_widget_destroy(dialog);
exit(EXIT_FAILURE);
- }
+ }
+
+ capplet->window = get_widget("preferred_apps_dialog");
+
+ g_signal_connect(capplet->window, "response", G_CALLBACK(close_cb), NULL);
+
+ capplet->web_browser_command_entry = get_widget("web_browser_command_entry");
+ capplet->web_browser_command_label = get_widget("web_browser_command_label");
+ capplet->web_browser_terminal_checkbutton = get_widget("web_browser_terminal_checkbutton");
+ capplet->default_radiobutton = get_widget("web_browser_default_radiobutton");
+ capplet->new_win_radiobutton = get_widget("web_browser_new_win_radiobutton");
+ capplet->new_tab_radiobutton = get_widget("web_browser_new_tab_radiobutton");
+
+ capplet->mail_reader_command_entry = get_widget("mail_reader_command_entry");
+ capplet->mail_reader_command_label = get_widget("mail_reader_command_label");
+ capplet->mail_reader_terminal_checkbutton = get_widget("mail_reader_terminal_checkbutton");
+
+ capplet->terminal_command_entry = get_widget("terminal_command_entry");
+ capplet->terminal_command_label = get_widget("terminal_command_label");
+ capplet->terminal_exec_flag_entry = get_widget("terminal_exec_flag_entry");
+ capplet->terminal_exec_flag_label = get_widget("terminal_exec_flag_label");
+
+ capplet->media_player_command_entry = get_widget("media_player_command_entry");
+ capplet->media_player_command_label = get_widget("media_player_command_label");
+ capplet->media_player_terminal_checkbutton = get_widget("media_player_terminal_checkbutton");
+
+ capplet->visual_command_entry = get_widget("visual_command_entry");
+ capplet->visual_command_label = get_widget("visual_command_label");
+ capplet->visual_startup_checkbutton = get_widget("visual_start_checkbutton");
+
+ capplet->image_viewer_command_entry = get_widget("image_command_entry");
+ capplet->image_viewer_command_label = get_widget("image_command_label");
+ capplet->image_viewer_terminal_checkbutton = get_widget("image_terminal_checkbox");
+
+ capplet->mobility_command_entry = get_widget("mobility_command_entry");
+ capplet->mobility_command_label = get_widget("mobility_command_label");
+ capplet->mobility_startup_checkbutton = get_widget("mobility_start_checkbutton");
+
+ capplet->web_combo_box = get_widget("web_browser_combobox");
+ capplet->mail_combo_box = get_widget("mail_reader_combobox");
+ capplet->term_combo_box = get_widget("terminal_combobox");
+ capplet->media_combo_box = get_widget("media_player_combobox");
+ capplet->visual_combo_box = get_widget("visual_combobox");
+ capplet->mobility_combo_box = get_widget("mobility_combobox");
+
+ capplet->text_combo_box = get_widget("text_combobox");
+ capplet->file_combo_box = get_widget("file_combobox");
+ capplet->image_combo_box = get_widget("image_combobox");
+
+
+ g_signal_connect(capplet->window, "screen-changed", G_CALLBACK(screen_changed_cb), capplet);
+ screen_changed_cb(capplet->window, gdk_screen_get_default(), capplet);
+
+ fill_combo_box(capplet->icon_theme, GTK_COMBO_BOX(capplet->web_combo_box), capplet->web_browsers);
+ fill_combo_box(capplet->icon_theme, GTK_COMBO_BOX(capplet->mail_combo_box), capplet->mail_readers);
+ fill_combo_box(capplet->icon_theme, GTK_COMBO_BOX(capplet->term_combo_box), capplet->terminals);
+ fill_combo_box(capplet->icon_theme, GTK_COMBO_BOX(capplet->media_combo_box), capplet->media_players);
+ fill_combo_box(capplet->icon_theme, GTK_COMBO_BOX(capplet->visual_combo_box), capplet->visual_ats);
+ fill_combo_box(capplet->icon_theme, GTK_COMBO_BOX(capplet->mobility_combo_box), capplet->mobility_ats);
+ fill_combo_box(capplet->icon_theme, GTK_COMBO_BOX(capplet->image_combo_box), capplet->image_viewers);
+
+ g_signal_connect(capplet->web_combo_box, "changed", G_CALLBACK(web_combo_changed_cb), capplet);
+ g_signal_connect(capplet->mail_combo_box, "changed", G_CALLBACK(mail_combo_changed_cb), capplet);
+ g_signal_connect(capplet->term_combo_box, "changed", G_CALLBACK(terminal_combo_changed_cb), capplet);
+ g_signal_connect(capplet->media_combo_box, "changed", G_CALLBACK(media_combo_changed_cb), capplet);
+ g_signal_connect(capplet->visual_combo_box, "changed", G_CALLBACK(visual_combo_changed_cb), capplet);
+ g_signal_connect(capplet->mobility_combo_box, "changed", G_CALLBACK(mobility_combo_changed_cb), capplet);
+ g_signal_connect(capplet->image_combo_box, "changed", G_CALLBACK(image_combo_changed_cb), capplet);
+
+
+ g_signal_connect(capplet->default_radiobutton, "toggled", G_CALLBACK(web_radiobutton_toggled_cb), capplet);
+ g_signal_connect(capplet->new_win_radiobutton, "toggled", G_CALLBACK(web_radiobutton_toggled_cb), capplet);
+ g_signal_connect(capplet->new_tab_radiobutton, "toggled", G_CALLBACK(web_radiobutton_toggled_cb), capplet);
+
+ /* Setup MateConfPropertyEditors */
+
+ /* Web Browser */
+ mateconf_peditor_new_combo_box (NULL,
+ DEFAULT_APPS_KEY_HTTP_EXEC,
+ capplet->web_combo_box,
+ "conv-from-widget-cb", web_combo_conv_from_widget,
+ "conv-to-widget-cb", web_combo_conv_to_widget,
+ "data", capplet,
+ NULL);
+
+ obj = mateconf_peditor_new_string (NULL,
+ DEFAULT_APPS_KEY_HTTP_EXEC,
+ capplet->web_browser_command_entry,
+ NULL);
+ g_signal_connect (obj, "value-changed", G_CALLBACK (web_mateconf_changed_cb), capplet);
+
+ obj = mateconf_peditor_new_boolean (NULL,
+ DEFAULT_APPS_KEY_HTTP_NEEDS_TERM,
+ capplet->web_browser_terminal_checkbutton,
+ NULL);
+ g_signal_connect (obj, "value-changed", G_CALLBACK (web_mateconf_changed_cb), capplet);
+
+ /* Mailer */
+ mateconf_peditor_new_combo_box (NULL,
+ DEFAULT_APPS_KEY_MAILER_EXEC,
+ capplet->mail_combo_box,
+ "conv-from-widget-cb", combo_conv_from_widget,
+ "conv-to-widget-cb", combo_conv_to_widget,
+ "data", capplet->mail_readers,
+ NULL);
+
+ mateconf_peditor_new_string (NULL,
+ DEFAULT_APPS_KEY_MAILER_EXEC,
+ capplet->mail_reader_command_entry,
+ NULL);
+
+ mateconf_peditor_new_boolean (NULL,
+ DEFAULT_APPS_KEY_MAILER_NEEDS_TERM,
+ capplet->mail_reader_terminal_checkbutton,
+ NULL);
+
+ /* Media player */
+ mateconf_peditor_new_combo_box (NULL,
+ DEFAULT_APPS_KEY_MEDIA_EXEC,
+ capplet->media_combo_box,
+ "conv-from-widget-cb", combo_conv_from_widget,
+ "conv-to-widget-cb", combo_conv_to_widget,
+ "data", capplet->media_players,
+ NULL);
+
+ mateconf_peditor_new_string (NULL,
+ DEFAULT_APPS_KEY_MEDIA_EXEC,
+ capplet->media_player_command_entry,
+ NULL);
+
+ mateconf_peditor_new_boolean (NULL,
+ DEFAULT_APPS_KEY_MEDIA_NEEDS_TERM,
+ capplet->media_player_terminal_checkbutton,
+ NULL);
+
+ /* Image viewer */
+ mateconf_peditor_new_combo_box(NULL,
+ DEFAULT_APPS_KEY_IMAGE_EXEC,
+ capplet->image_combo_box,
+ "conv-from-widget-cb", combo_conv_from_widget,
+ "conv-to-widget-cb", combo_conv_to_widget,
+ "data", capplet->image_viewers,
+ NULL);
+
+ mateconf_peditor_new_string (NULL,
+ DEFAULT_APPS_KEY_IMAGE_EXEC,
+ capplet->image_viewer_command_entry,
+ NULL);
+
+ mateconf_peditor_new_boolean (NULL,
+ DEFAULT_APPS_KEY_IMAGE_NEEDS_TERM,
+ capplet->image_viewer_terminal_checkbutton,
+ NULL);
+
+ /* Terminal */
+ mateconf_peditor_new_combo_box (NULL,
+ DEFAULT_APPS_KEY_TERMINAL_EXEC,
+ capplet->term_combo_box,
+ "conv-from-widget-cb", combo_conv_from_widget,
+ "conv-to-widget-cb", combo_conv_to_widget,
+ "data", capplet->terminals,
+ NULL);
- capplet->window = _gtk_builder_get_widget (builder,"preferred_apps_dialog");
-
- g_signal_connect(capplet->window, "response", G_CALLBACK (close_cb), NULL);
-
- #define _gtk_builder_get_widget(builder, name) GTK_WIDGET(gtk_builder_get_object(builder, name))
-
- capplet->web_browser_command_entry = _gtk_builder_get_widget (builder, "web_browser_command_entry");
- capplet->web_browser_command_label = _gtk_builder_get_widget (builder, "web_browser_command_label");
- capplet->web_browser_terminal_checkbutton = _gtk_builder_get_widget(builder, "web_browser_terminal_checkbutton");
- capplet->default_radiobutton = _gtk_builder_get_widget (builder, "web_browser_default_radiobutton");
- capplet->new_win_radiobutton = _gtk_builder_get_widget (builder, "web_browser_new_win_radiobutton");
- capplet->new_tab_radiobutton = _gtk_builder_get_widget (builder, "web_browser_new_tab_radiobutton");
-
- capplet->mail_reader_command_entry = _gtk_builder_get_widget (builder, "mail_reader_command_entry");
- capplet->mail_reader_command_label = _gtk_builder_get_widget (builder, "mail_reader_command_label");
- capplet->mail_reader_terminal_checkbutton = _gtk_builder_get_widget (builder, "mail_reader_terminal_checkbutton");
-
- capplet->terminal_command_entry = _gtk_builder_get_widget (builder, "terminal_command_entry");
- capplet->terminal_command_label = _gtk_builder_get_widget (builder, "terminal_command_label");
- capplet->terminal_exec_flag_entry = _gtk_builder_get_widget (builder, "terminal_exec_flag_entry");
- capplet->terminal_exec_flag_label = _gtk_builder_get_widget (builder, "terminal_exec_flag_label");
-
- capplet->media_player_command_entry = _gtk_builder_get_widget (builder, "media_player_command_entry");
- capplet->media_player_command_label = _gtk_builder_get_widget (builder, "media_player_command_label");
- capplet->media_player_terminal_checkbutton = _gtk_builder_get_widget (builder, "media_player_terminal_checkbutton");
-
- capplet->visual_command_entry = _gtk_builder_get_widget (builder, "visual_command_entry");
- capplet->visual_command_label = _gtk_builder_get_widget (builder, "visual_command_label");
- capplet->visual_startup_checkbutton = _gtk_builder_get_widget (builder, "visual_start_checkbutton");
-
- capplet->mobility_command_entry = _gtk_builder_get_widget (builder, "mobility_command_entry");
- capplet->mobility_command_label = _gtk_builder_get_widget (builder, "mobility_command_label");
- capplet->mobility_startup_checkbutton = _gtk_builder_get_widget (builder, "mobility_start_checkbutton");
-
- capplet->web_combo_box = _gtk_builder_get_widget(builder, "web_browser_combobox");
- capplet->mail_combo_box = _gtk_builder_get_widget(builder, "mail_reader_combobox");
- capplet->term_combo_box = _gtk_builder_get_widget(builder, "terminal_combobox");
- capplet->media_combo_box = _gtk_builder_get_widget(builder, "media_player_combobox");
- capplet->visual_combo_box = _gtk_builder_get_widget(builder, "visual_combobox");
- capplet->mobility_combo_box = _gtk_builder_get_widget(builder, "mobility_combobox");
-
- capplet->text_combo_box = _gtk_builder_get_widget(builder, "text_combobox");
- capplet->file_combo_box = _gtk_builder_get_widget(builder, "file_combobox");
-
- #undef _gtk_builder_get_widget
-
-
- g_signal_connect(capplet->window, "screen-changed", G_CALLBACK(screen_changed_cb), capplet);
- screen_changed_cb(capplet->window, gdk_screen_get_default(), capplet);
-
- fill_combo_box(capplet->icon_theme, GTK_COMBO_BOX(capplet->web_combo_box), capplet->web_browsers);
- fill_combo_box(capplet->icon_theme, GTK_COMBO_BOX(capplet->mail_combo_box), capplet->mail_readers);
- fill_combo_box(capplet->icon_theme, GTK_COMBO_BOX(capplet->term_combo_box), capplet->terminals);
- fill_combo_box(capplet->icon_theme, GTK_COMBO_BOX(capplet->media_combo_box), capplet->media_players);
- fill_combo_box(capplet->icon_theme, GTK_COMBO_BOX(capplet->visual_combo_box), capplet->visual_ats);
- fill_combo_box(capplet->icon_theme, GTK_COMBO_BOX(capplet->mobility_combo_box), capplet->mobility_ats);
-
- g_signal_connect(capplet->web_combo_box, "changed", G_CALLBACK(web_combo_changed_cb), capplet);
- g_signal_connect(capplet->mail_combo_box, "changed", G_CALLBACK(mail_combo_changed_cb), capplet);
- g_signal_connect(capplet->term_combo_box, "changed", G_CALLBACK(terminal_combo_changed_cb), capplet);
- g_signal_connect(capplet->media_combo_box, "changed", G_CALLBACK(media_combo_changed_cb), capplet);
- g_signal_connect(capplet->visual_combo_box, "changed", G_CALLBACK(visual_combo_changed_cb), capplet);
- g_signal_connect(capplet->mobility_combo_box, "changed", G_CALLBACK(mobility_combo_changed_cb), capplet);
-
-
- g_signal_connect(capplet->default_radiobutton, "toggled", G_CALLBACK(web_radiobutton_toggled_cb), capplet);
- g_signal_connect(capplet->new_win_radiobutton, "toggled", G_CALLBACK(web_radiobutton_toggled_cb), capplet);
- g_signal_connect(capplet->new_tab_radiobutton, "toggled", G_CALLBACK(web_radiobutton_toggled_cb), capplet);
-
- /* Setup MateConfPropertyEditors */
-
- /* Web Browser */
- mateconf_peditor_new_combo_box (NULL,
- DEFAULT_APPS_KEY_HTTP_EXEC,
- capplet->web_combo_box,
- "conv-from-widget-cb", web_combo_conv_from_widget,
- "conv-to-widget-cb", web_combo_conv_to_widget,
- "data", capplet,
- NULL);
-
- obj = mateconf_peditor_new_string (NULL,
- DEFAULT_APPS_KEY_HTTP_EXEC,
- capplet->web_browser_command_entry,
- NULL);
- g_signal_connect (obj, "value-changed", G_CALLBACK (web_mateconf_changed_cb), capplet);
-
- obj = mateconf_peditor_new_boolean (NULL,
- DEFAULT_APPS_KEY_HTTP_NEEDS_TERM,
- capplet->web_browser_terminal_checkbutton,
- NULL);
- g_signal_connect (obj, "value-changed", G_CALLBACK (web_mateconf_changed_cb), capplet);
-
- /* Mailer */
- mateconf_peditor_new_combo_box (NULL,
- DEFAULT_APPS_KEY_MAILER_EXEC,
- capplet->mail_combo_box,
- "conv-from-widget-cb", combo_conv_from_widget,
- "conv-to-widget-cb", combo_conv_to_widget,
- "data", capplet->mail_readers,
- NULL);
-
- mateconf_peditor_new_string (NULL,
- DEFAULT_APPS_KEY_MAILER_EXEC,
- capplet->mail_reader_command_entry,
- NULL);
-
- mateconf_peditor_new_boolean (NULL,
- DEFAULT_APPS_KEY_MAILER_NEEDS_TERM,
- capplet->mail_reader_terminal_checkbutton,
- NULL);
-
- /* Media player */
- mateconf_peditor_new_combo_box (NULL,
- DEFAULT_APPS_KEY_MEDIA_EXEC,
- capplet->media_combo_box,
- "conv-from-widget-cb", combo_conv_from_widget,
- "conv-to-widget-cb", combo_conv_to_widget,
- "data", capplet->media_players,
- NULL);
-
- mateconf_peditor_new_string (NULL,
- DEFAULT_APPS_KEY_MEDIA_EXEC,
- capplet->media_player_command_entry,
- NULL);
-
- mateconf_peditor_new_boolean (NULL,
- DEFAULT_APPS_KEY_MEDIA_NEEDS_TERM,
- capplet->media_player_terminal_checkbutton,
- NULL);
-
- /* Terminal */
- mateconf_peditor_new_combo_box (NULL,
- DEFAULT_APPS_KEY_TERMINAL_EXEC,
- capplet->term_combo_box,
- "conv-from-widget-cb", combo_conv_from_widget,
- "conv-to-widget-cb", combo_conv_to_widget,
- "data", capplet->terminals,
- NULL);
-
- mateconf_peditor_new_combo_box (NULL,
- DEFAULT_APPS_KEY_TERMINAL_EXEC_ARG,
- capplet->term_combo_box,
- "conv-from-widget-cb", combo_conv_from_widget_term_flag,
- "conv-to-widget-cb", combo_conv_to_widget_term_flag,
- "data", capplet->terminals,
- NULL);
-
- mateconf_peditor_new_string (NULL,
- DEFAULT_APPS_KEY_TERMINAL_EXEC,
- capplet->terminal_command_entry,
- NULL);
- mateconf_peditor_new_string (NULL,
- DEFAULT_APPS_KEY_TERMINAL_EXEC_ARG,
- capplet->terminal_exec_flag_entry,
- NULL);
-
-
- /* Visual */
- mateconf_peditor_new_combo_box (NULL,
- DEFAULT_APPS_KEY_VISUAL_EXEC,
- capplet->visual_combo_box,
- "conv-from-widget-cb", combo_conv_from_widget,
- "conv-to-widget-cb", combo_conv_to_widget,
- "data", capplet->visual_ats,
- NULL);
-
- mateconf_peditor_new_string (NULL,
- DEFAULT_APPS_KEY_VISUAL_EXEC,
- capplet->visual_command_entry,
- NULL);
-
- mateconf_peditor_new_boolean (NULL,
- DEFAULT_APPS_KEY_VISUAL_STARTUP,
- capplet->visual_startup_checkbutton,
- NULL);
-
-
- /* Mobility */
- mateconf_peditor_new_combo_box (NULL,
- DEFAULT_APPS_KEY_MOBILITY_EXEC,
- capplet->mobility_combo_box,
- "conv-from-widget-cb", combo_conv_from_widget,
- "conv-to-widget-cb", combo_conv_to_widget,
- "data", capplet->mobility_ats,
- NULL);
-
- mateconf_peditor_new_string (NULL,
- DEFAULT_APPS_KEY_MOBILITY_EXEC,
- capplet->mobility_command_entry,
- NULL);
-
- mateconf_peditor_new_boolean (NULL,
- DEFAULT_APPS_KEY_MOBILITY_STARTUP,
- capplet->mobility_startup_checkbutton,
- NULL);
+ mateconf_peditor_new_combo_box (NULL,
+ DEFAULT_APPS_KEY_TERMINAL_EXEC_ARG,
+ capplet->term_combo_box,
+ "conv-from-widget-cb", combo_conv_from_widget_term_flag,
+ "conv-to-widget-cb", combo_conv_to_widget_term_flag,
+ "data", capplet->terminals,
+ NULL);
+
+ mateconf_peditor_new_string (NULL,
+ DEFAULT_APPS_KEY_TERMINAL_EXEC,
+ capplet->terminal_command_entry,
+ NULL);
+ mateconf_peditor_new_string (NULL,
+ DEFAULT_APPS_KEY_TERMINAL_EXEC_ARG,
+ capplet->terminal_exec_flag_entry,
+ NULL);
+
+
+ /* Visual */
+ mateconf_peditor_new_combo_box (NULL,
+ DEFAULT_APPS_KEY_VISUAL_EXEC,
+ capplet->visual_combo_box,
+ "conv-from-widget-cb", combo_conv_from_widget,
+ "conv-to-widget-cb", combo_conv_to_widget,
+ "data", capplet->visual_ats,
+ NULL);
+
+ mateconf_peditor_new_string (NULL,
+ DEFAULT_APPS_KEY_VISUAL_EXEC,
+ capplet->visual_command_entry,
+ NULL);
+
+ mateconf_peditor_new_boolean (NULL,
+ DEFAULT_APPS_KEY_VISUAL_STARTUP,
+ capplet->visual_startup_checkbutton,
+ NULL);
+
+
+ /* Mobility */
+ mateconf_peditor_new_combo_box (NULL,
+ DEFAULT_APPS_KEY_MOBILITY_EXEC,
+ capplet->mobility_combo_box,
+ "conv-from-widget-cb", combo_conv_from_widget,
+ "conv-to-widget-cb", combo_conv_to_widget,
+ "data", capplet->mobility_ats,
+ NULL);
+
+ mateconf_peditor_new_string (NULL,
+ DEFAULT_APPS_KEY_MOBILITY_EXEC,
+ capplet->mobility_command_entry,
+ NULL);
+
+ mateconf_peditor_new_boolean (NULL,
+ DEFAULT_APPS_KEY_MOBILITY_STARTUP,
+ capplet->mobility_startup_checkbutton,
+ NULL);
gtk_window_set_icon_name (GTK_WINDOW (capplet->window), "preferences-desktop-default-applications");
- if (start_page != NULL)
- {
- gchar* page_name;
- GtkWidget* w;
+ if (start_page != NULL)
+ {
+ gchar* page_name;
+ GtkWidget* w;
- page_name = g_strconcat (start_page, "_vbox", NULL);
+ page_name = g_strconcat (start_page, "_vbox", NULL);
- w = _gtk_builder_get_widget (builder, page_name);
+ w = get_widget(page_name);
- if (w != NULL)
- {
- GtkNotebook *nb;
- gint pindex;
+ if (w != NULL)
+ {
+ GtkNotebook *nb;
+ gint pindex;
+
+ nb = GTK_NOTEBOOK (get_widget("preferred_apps_notebook"));
+ pindex = gtk_notebook_page_num (nb, w);
+ if (pindex != -1)
+ gtk_notebook_set_current_page (nb, pindex);
+ }
- nb = GTK_NOTEBOOK (_gtk_builder_get_widget (builder, "preferred_apps_notebook"));
- pindex = gtk_notebook_page_num (nb, w);
- if (pindex != -1)
- gtk_notebook_set_current_page (nb, pindex);
- }
+ g_free(page_name);
+ }
- g_free(page_name);
- }
+ gtk_widget_show(capplet->window);
- gtk_widget_show(capplet->window);
+ #undef get_widget
}
int main(int argc, char** argv)
diff --git a/capplets/default-applications/mate-da-capplet.h b/capplets/default-applications/mate-da-capplet.h
index e19dd70e..e149e39b 100644
--- a/capplets/default-applications/mate-da-capplet.h
+++ b/capplets/default-applications/mate-da-capplet.h
@@ -2,6 +2,7 @@
* Authors: Luca Cavalli <[email protected]>
*
* Copyright 2005-2006 Luca Cavalli
+ * Copyright 2010 Perberos <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of version 2 of the GNU General Public License
@@ -61,6 +62,10 @@
#define DEFAULT_APPS_KEY_MEDIA_EXEC DEFAULT_APPS_KEY_MEDIA_PATH"/exec"
#define DEFAULT_APPS_KEY_MEDIA_NEEDS_TERM DEFAULT_APPS_KEY_MEDIA_PATH"/needs_term"
+#define DEFAULT_APPS_KEY_IMAGE_PATH "/desktop/mate/applications/image"
+#define DEFAULT_APPS_KEY_IMAGE_EXEC DEFAULT_APPS_KEY_IMAGE_PATH"/exec"
+#define DEFAULT_APPS_KEY_IMAGE_NEEDS_TERM DEFAULT_APPS_KEY_IMAGE_PATH"/needs_term"
+
#define DEFAULT_APPS_KEY_VISUAL_PATH "/desktop/mate/applications/at/visual"
#define DEFAULT_APPS_KEY_VISUAL_EXEC DEFAULT_APPS_KEY_VISUAL_PATH"/exec"
#define DEFAULT_APPS_KEY_VISUAL_STARTUP DEFAULT_APPS_KEY_VISUAL_PATH"/startup"
@@ -87,6 +92,7 @@ struct _MateDACapplet {
/* Para el File Manager */
GtkWidget* file_combo_box;
GtkWidget* text_combo_box;
+ GtkWidget* image_combo_box;
GtkWidget* web_browser_command_entry;
@@ -126,6 +132,11 @@ struct _MateDACapplet {
GtkWidget* mobility_command_label;
GtkWidget* mobility_startup_checkbutton;
+
+ GtkWidget* image_viewer_command_entry;
+ GtkWidget* image_viewer_command_label;
+ GtkWidget* image_viewer_terminal_checkbutton;
+
MateConfClient* mateconf;
GList* web_browsers;
@@ -136,6 +147,7 @@ struct _MateDACapplet {
GList* mobility_ats;
/* Para el File Manager */
GList* file_managers;
+ GList* image_viewers;
};
#endif
diff --git a/capplets/default-applications/mate-da-item.c b/capplets/default-applications/mate-da-item.c
index 06bda549..7cdfa768 100644
--- a/capplets/default-applications/mate-da-item.c
+++ b/capplets/default-applications/mate-da-item.c
@@ -21,128 +21,134 @@
#include "mate-da-capplet.h"
#include "mate-da-item.h"
-MateDAWebItem*
-mate_da_web_item_new (void)
+MateDAWebItem* mate_da_web_item_new(void)
{
- MateDAWebItem *item = NULL;
+ MateDAWebItem* item = g_new0(MateDAWebItem, 1);
- item = g_new0 (MateDAWebItem, 1);
-
- return item;
+ return item;
}
-MateDASimpleItem*
-mate_da_simple_item_new (void)
+MateDASimpleItem* mate_da_simple_item_new(void)
{
- MateDASimpleItem *item = NULL;
-
- item = g_new0 (MateDASimpleItem, 1);
+ MateDASimpleItem* item = g_new0(MateDASimpleItem, 1);
- return item;
+ return item;
}
-MateDATermItem*
-mate_da_term_item_new (void)
+MateDATermItem* mate_da_term_item_new(void)
{
- MateDATermItem *item = NULL;
-
- item = g_new0 (MateDATermItem, 1);
+ MateDATermItem* item = g_new0(MateDATermItem, 1);
- return item;
+ return item;
}
-MateDAVisualItem*
-mate_da_visual_item_new (void)
+MateDAVisualItem* mate_da_visual_item_new(void)
{
- MateDAVisualItem *item = NULL;
+ MateDAVisualItem* item = g_new0(MateDAVisualItem, 1);
- item = g_new0 (MateDAVisualItem, 1);
-
- return item;
+ return item;
}
-MateDAMobilityItem*
-mate_da_mobility_item_new (void)
+MateDAImageItem* mate_da_image_item_new(void)
{
- MateDAMobilityItem *item = NULL;
-
- item = g_new0 (MateDAMobilityItem, 1);
+ MateDAImageItem* item = g_new0(MateDAImageItem, 1);
- return item;
+ return item;
}
-void
-mate_da_web_item_free (MateDAWebItem *item)
+MateDAMobilityItem* mate_da_mobility_item_new(void)
{
- g_return_if_fail (item != NULL);
+ MateDAMobilityItem* item = g_new0(MateDAMobilityItem, 1);
- g_free (item->generic.name);
- g_free (item->generic.executable);
- g_free (item->generic.command);
- g_free (item->generic.icon_name);
- g_free (item->generic.icon_path);
-
- g_free (item->tab_command);
- g_free (item->win_command);
-
- g_free (item);
+ return item;
}
-void
-mate_da_simple_item_free (MateDASimpleItem *item)
+void mate_da_web_item_free(MateDAWebItem* item)
{
- g_return_if_fail (item != NULL);
-
- g_free (item->generic.name);
- g_free (item->generic.executable);
- g_free (item->generic.command);
- g_free (item->generic.icon_name);
- g_free (item->generic.icon_path);
-
- g_free (item);
+ if (item != NULL)
+ {
+ g_free(item->generic.name);
+ g_free(item->generic.executable);
+ g_free(item->generic.command);
+ g_free(item->generic.icon_name);
+ g_free(item->generic.icon_path);
+
+ g_free(item->tab_command);
+ g_free(item->win_command);
+
+ g_free(item);
+ }
}
-void
-mate_da_term_item_free (MateDATermItem *item)
+void mate_da_simple_item_free(MateDASimpleItem* item)
{
- g_return_if_fail (item != NULL);
-
- g_free (item->generic.name);
- g_free (item->generic.executable);
- g_free (item->generic.command);
- g_free (item->generic.icon_name);
- g_free (item->generic.icon_path);
-
- g_free (item->exec_flag);
-
- g_free (item);
+ if (item != NULL)
+ {
+ g_free(item->generic.name);
+ g_free(item->generic.executable);
+ g_free(item->generic.command);
+ g_free(item->generic.icon_name);
+ g_free(item->generic.icon_path);
+
+ g_free(item);
+ }
}
-void
-mate_da_visual_item_free (MateDAVisualItem *item)
+void mate_da_image_item_free(MateDAImageItem* item)
{
- g_return_if_fail (item != NULL);
-
- g_free (item->generic.name);
- g_free (item->generic.executable);
- g_free (item->generic.command);
- g_free (item->generic.icon_name);
- g_free (item->generic.icon_path);
-
- g_free (item);
+ if (item != NULL)
+ {
+ g_free(item->generic.name);
+ g_free(item->generic.executable);
+ g_free(item->generic.command);
+ g_free(item->generic.icon_name);
+ g_free(item->generic.icon_path);
+
+ g_free(item);
+ }
}
-void
-mate_da_mobility_item_free (MateDAMobilityItem *item)
+void mate_da_term_item_free(MateDATermItem* item)
{
- g_return_if_fail (item != NULL);
+ if (item != NULL)
+ {
+ g_free(item->generic.name);
+ g_free(item->generic.executable);
+ g_free(item->generic.command);
+ g_free(item->generic.icon_name);
+ g_free(item->generic.icon_path);
+
+ g_free(item->exec_flag);
+
+ g_free(item);
+ }
+}
- g_free (item->generic.name);
- g_free (item->generic.executable);
- g_free (item->generic.command);
- g_free (item->generic.icon_name);
- g_free (item->generic.icon_path);
+void mate_da_visual_item_free(MateDAVisualItem* item)
+{
+ if (item != NULL)
+ {
+ g_free(item->generic.name);
+ g_free(item->generic.executable);
+ g_free(item->generic.command);
+ g_free(item->generic.icon_name);
+ g_free(item->generic.icon_path);
+
+ g_free(item);
+ }
+}
- g_free (item);
+void mate_da_mobility_item_free (MateDAMobilityItem *item)
+{
+ if (item != NULL)
+ {
+ g_free(item->generic.name);
+ g_free(item->generic.executable);
+ g_free(item->generic.command);
+ g_free(item->generic.icon_name);
+ g_free(item->generic.icon_path);
+
+ g_free(item);
+ }
}
diff --git a/capplets/default-applications/mate-da-item.h b/capplets/default-applications/mate-da-item.h
index d3bfb4ca..3462840c 100644
--- a/capplets/default-applications/mate-da-item.h
+++ b/capplets/default-applications/mate-da-item.h
@@ -23,59 +23,63 @@
#include <glib.h>
-typedef struct _MateDAItem MateDAItem;
-
-typedef struct _MateDAWebItem MateDAWebItem;
-typedef struct _MateDATermItem MateDATermItem;
-typedef struct _MateDASimpleItem MateDASimpleItem;
-typedef struct _MateDAVisualItem MateDAVisualItem;
-typedef struct _MateDAMobilityItem MateDAMobilityItem;
-
-struct _MateDAItem {
- gchar *name;
- gchar *executable;
- gchar *command;
- gchar *icon_name;
- gchar *icon_path;
-};
-
-struct _MateDAWebItem {
- MateDAItem generic;
- gboolean run_in_terminal;
- gboolean netscape_remote;
- gchar* tab_command;
- gchar* win_command;
-};
-
-struct _MateDASimpleItem {
- MateDAItem generic;
- gboolean run_in_terminal;
-};
-
-struct _MateDATermItem {
- MateDAItem generic;
- gchar *exec_flag;
-};
-
-struct _MateDAVisualItem {
- MateDAItem generic;
- gboolean run_at_startup;
-};
-
-struct _MateDAMobilityItem {
- MateDAItem generic;
- gboolean run_at_startup;
-};
-
-MateDAWebItem* mate_da_web_item_new (void);
-MateDATermItem* mate_da_term_item_new (void);
-MateDASimpleItem* mate_da_simple_item_new (void);
-MateDAVisualItem* mate_da_visual_item_new (void);
-MateDAMobilityItem* mate_da_mobility_item_new (void);
-void mate_da_web_item_free (MateDAWebItem *item);
-void mate_da_term_item_free (MateDATermItem *item);
-void mate_da_simple_item_free (MateDASimpleItem *item);
-void mate_da_visual_item_free (MateDAVisualItem *item);
-void mate_da_mobility_item_free (MateDAMobilityItem *item);
+typedef struct _MateDAItem {
+ gchar* name;
+ gchar* executable;
+ gchar* command;
+ gchar* icon_name;
+ gchar* icon_path;
+} MateDAItem;
+
+typedef struct _MateDAWebItem {
+ MateDAItem generic;
+ gboolean run_in_terminal;
+ gboolean netscape_remote;
+ gchar* tab_command;
+ gchar* win_command;
+} MateDAWebItem;
+
+typedef struct _MateDASimpleItem {
+ MateDAItem generic;
+ gboolean run_in_terminal;
+} MateDASimpleItem;
+
+typedef struct _MateDAImageItem {
+ MateDAItem generic;
+ gboolean run_in_terminal;
+} MateDAImageItem;
+
+typedef struct _MateDATermItem {
+ MateDAItem generic;
+ gchar* exec_flag;
+} MateDATermItem;
+
+typedef struct _MateDAVisualItem {
+ MateDAItem generic;
+ gboolean run_at_startup;
+} MateDAVisualItem;
+
+typedef struct _MateDAMobilityItem {
+ MateDAItem generic;
+ gboolean run_at_startup;
+} MateDAMobilityItem;
+
+MateDAWebItem* mate_da_web_item_new(void);
+void mate_da_web_item_free(MateDAWebItem* item);
+
+MateDATermItem* mate_da_term_item_new(void);
+void mate_da_term_item_free(MateDATermItem* item);
+
+MateDASimpleItem* mate_da_simple_item_new(void);
+void mate_da_simple_item_free(MateDASimpleItem* item);
+
+MateDAVisualItem* mate_da_visual_item_new(void);
+void mate_da_visual_item_free(MateDAVisualItem* item);
+
+MateDAImageItem* mate_da_image_item_new(void);
+void mate_da_image_item_free(MateDAImageItem* item);
+
+MateDAMobilityItem* mate_da_mobility_item_new(void);
+void mate_da_mobility_item_free(MateDAMobilityItem* item);
#endif
diff --git a/capplets/default-applications/mate-da-xml.c b/capplets/default-applications/mate-da-xml.c
index 4105f2ce..ba41aa1f 100644
--- a/capplets/default-applications/mate-da-xml.c
+++ b/capplets/default-applications/mate-da-xml.c
@@ -2,6 +2,7 @@
* Authors: Luca Cavalli <[email protected]>
*
* Copyright 2005-2006 Luca Cavalli
+ * Copyright 2010 Perberos <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of version 2 of the GNU General Public License
@@ -28,8 +29,7 @@
#include "mate-da-item.h"
-static gboolean
-mate_da_xml_get_bool (const xmlNode *parent, const gchar *val_name)
+static gboolean mate_da_xml_get_bool(const xmlNode* parent, const gchar* val_name)
{
xmlNode *element;
gboolean ret_val = FALSE;
@@ -60,8 +60,7 @@ mate_da_xml_get_bool (const xmlNode *parent, const gchar *val_name)
return ret_val;
}
-static gchar*
-mate_da_xml_get_string (const xmlNode *parent, const gchar *val_name)
+static gchar* mate_da_xml_get_string(const xmlNode* parent, const gchar* val_name)
{
const gchar * const *sys_langs;
xmlChar *node_lang;
@@ -108,176 +107,250 @@ mate_da_xml_get_string (const xmlNode *parent, const gchar *val_name)
return ret_val;
}
-static gboolean
-is_executable_valid (gchar *executable)
+static gboolean is_executable_valid(gchar* executable)
{
- gchar *path;
+ gchar* path = g_find_program_in_path(executable);
- path = g_find_program_in_path (executable);
-
- if (path) {
- g_free (path);
- return TRUE;
- }
+ if (path)
+ {
+ g_free (path);
+ return TRUE;
+ }
- return FALSE;
+ return FALSE;
}
-static void
-mate_da_xml_load_xml (MateDACapplet *capplet, const gchar * filename)
+static void mate_da_xml_load_xml(MateDACapplet* capplet, const gchar* filename)
{
- xmlDoc *xml_doc;
- xmlNode *root, *section, *element;
- gchar *executable;
- MateDAWebItem *web_item;
- MateDASimpleItem *mail_item;
- MateDASimpleItem *media_item;
- MateDATermItem *term_item;
- MateDAVisualItem *visual_item;
- MateDAMobilityItem *mobility_item;
-
- xml_doc = xmlParseFile (filename);
-
- if (!xml_doc)
- return;
-
- root = xmlDocGetRootElement (xml_doc);
-
- for (section = root->children; section != NULL; section = section->next) {
- if (!xmlStrncmp(section->name, (const xmlChar*) "web-browsers", strlen("web-browsers"))) {
- for (element = section->children; element != NULL; element = element->next) {
- if (!xmlStrncmp (element->name, (const xmlChar*) "web-browser", strlen("web-browser"))) {
- executable = mate_da_xml_get_string (element, "executable");
- if (is_executable_valid (executable)) {
- web_item = mate_da_web_item_new ();
-
- web_item->generic.name = mate_da_xml_get_string (element, "name");
- web_item->generic.executable = executable;
- web_item->generic.command = mate_da_xml_get_string (element, "command");
- web_item->generic.icon_name = mate_da_xml_get_string (element, "icon-name");
-
- web_item->run_in_terminal = mate_da_xml_get_bool (element, "run-in-terminal");
- web_item->netscape_remote = mate_da_xml_get_bool (element, "netscape-remote");
- if (web_item->netscape_remote) {
- web_item->tab_command = mate_da_xml_get_string (element, "tab-command");
- web_item->win_command = mate_da_xml_get_string (element, "win-command");
- }
-
- capplet->web_browsers = g_list_append (capplet->web_browsers, web_item);
- }
- else
- g_free (executable);
- }
- }
+ xmlDoc* xml_doc;
+ xmlNode* root;
+ xmlNode* section;
+ xmlNode* element;
+ gchar* executable;
+ MateDAWebItem* web_item;
+ MateDASimpleItem* mail_item;
+ MateDASimpleItem* media_item;
+ MateDATermItem* term_item;
+ MateDAVisualItem* visual_item;
+ MateDAMobilityItem* mobility_item;
+ MateDAImageItem* image_item;
+
+ xml_doc = xmlParseFile(filename);
+
+ if (!xml_doc)
+ {
+ return;
}
- else if (!xmlStrncmp (section->name, (const xmlChar*) "mail-readers", strlen("mail-readers"))) {
- for (element = section->children; element != NULL; element = element->next) {
- if (!xmlStrncmp (element->name, (const xmlChar*) "mail-reader", strlen("mail-reader"))) {
- executable = mate_da_xml_get_string (element, "executable");
- if (is_executable_valid (executable)) {
- mail_item = mate_da_simple_item_new ();
- mail_item->generic.name = mate_da_xml_get_string (element, "name");
- mail_item->generic.executable = executable;
- mail_item->generic.command = mate_da_xml_get_string (element, "command");
- mail_item->generic.icon_name = mate_da_xml_get_string (element, "icon-name");
+ root = xmlDocGetRootElement(xml_doc);
- mail_item->run_in_terminal = mate_da_xml_get_bool (element, "run-in-terminal");
-
- capplet->mail_readers = g_list_append (capplet->mail_readers, mail_item);
- }
- else
- g_free (executable);
+ for (section = root->children; section != NULL; section = section->next)
+ {
+ if (!xmlStrncmp(section->name, (const xmlChar*) "web-browsers", strlen("web-browsers")))
+ {
+ for (element = section->children; element != NULL; element = element->next)
+ {
+ if (!xmlStrncmp (element->name, (const xmlChar*) "web-browser", strlen("web-browser")))
+ {
+ executable = mate_da_xml_get_string (element, "executable");
+
+ if (is_executable_valid (executable))
+ {
+ web_item = mate_da_web_item_new();
+
+ web_item->generic.name = mate_da_xml_get_string(element, "name");
+ web_item->generic.executable = executable;
+ web_item->generic.command = mate_da_xml_get_string(element, "command");
+ web_item->generic.icon_name = mate_da_xml_get_string(element, "icon-name");
+
+ web_item->run_in_terminal = mate_da_xml_get_bool(element, "run-in-terminal");
+ web_item->netscape_remote = mate_da_xml_get_bool(element, "netscape-remote");
+ if (web_item->netscape_remote)
+ {
+ web_item->tab_command = mate_da_xml_get_string(element, "tab-command");
+ web_item->win_command = mate_da_xml_get_string(element, "win-command");
+ }
+
+ capplet->web_browsers = g_list_append(capplet->web_browsers, web_item);
+ }
+ else
+ {
+ g_free(executable);
+ }
+ }
+ }
}
- }
- }
- else if (!xmlStrncmp (section->name, (const xmlChar*) "terminals", strlen("terminals"))) {
- for (element = section->children; element != NULL; element = element->next) {
- if (!xmlStrncmp (element->name, (const xmlChar*) "terminal", strlen("terminal"))) {
- executable = mate_da_xml_get_string (element, "executable");
- if (is_executable_valid (executable)) {
- term_item = mate_da_term_item_new ();
-
- term_item->generic.name = mate_da_xml_get_string (element, "name");
- term_item->generic.executable = executable;
- term_item->generic.command = mate_da_xml_get_string (element, "command");
- term_item->generic.icon_name = mate_da_xml_get_string (element, "icon-name");
-
- term_item->exec_flag = mate_da_xml_get_string (element, "exec-flag");
-
- capplet->terminals = g_list_append (capplet->terminals, term_item);
- }
- else
- g_free (executable);
+ else if (!xmlStrncmp(section->name, (const xmlChar*) "mail-readers", strlen("mail-readers")))
+ {
+ for (element = section->children; element != NULL; element = element->next)
+ {
+ if (!xmlStrncmp (element->name, (const xmlChar*) "mail-reader", strlen("mail-reader")))
+ {
+ executable = mate_da_xml_get_string(element, "executable");
+
+ if (is_executable_valid(executable))
+ {
+ mail_item = mate_da_simple_item_new();
+
+ mail_item->generic.name = mate_da_xml_get_string(element, "name");
+ mail_item->generic.executable = executable;
+ mail_item->generic.command = mate_da_xml_get_string(element, "command");
+ mail_item->generic.icon_name = mate_da_xml_get_string(element, "icon-name");
+
+ mail_item->run_in_terminal = mate_da_xml_get_bool(element, "run-in-terminal");
+
+ capplet->mail_readers = g_list_append(capplet->mail_readers, mail_item);
+ }
+ else
+ {
+ g_free (executable);
+ }
+ }
+ }
}
- }
- }
- else if (!xmlStrncmp (section->name, (const xmlChar*) "music-players", strlen("music-players"))) {
- for (element = section->children; element != NULL; element = element->next) {
- if (!xmlStrncmp (element->name, (const xmlChar*) "music-player", strlen("music-player"))) {
- executable = mate_da_xml_get_string (element, "executable");
- if (is_executable_valid (executable)) {
- media_item = mate_da_simple_item_new ();
-
- media_item->generic.name = mate_da_xml_get_string (element, "name");
- media_item->generic.executable = executable;
- media_item->generic.command = mate_da_xml_get_string (element, "command");
- media_item->generic.icon_name = mate_da_xml_get_string (element, "icon-name");
-
- media_item->run_in_terminal = mate_da_xml_get_bool (element, "run-in-terminal");
-
- capplet->media_players = g_list_append (capplet->media_players, media_item);
- }
- else
- g_free (executable);
+ else if (!xmlStrncmp(section->name, (const xmlChar*) "terminals", strlen("terminals")))
+ {
+ for (element = section->children; element != NULL; element = element->next)
+ {
+ if (!xmlStrncmp (element->name, (const xmlChar*) "terminal", strlen("terminal")))
+ {
+ executable = mate_da_xml_get_string(element, "executable");
+
+ if (is_executable_valid(executable))
+ {
+ term_item = mate_da_term_item_new();
+
+ term_item->generic.name = mate_da_xml_get_string(element, "name");
+ term_item->generic.executable = executable;
+ term_item->generic.command = mate_da_xml_get_string(element, "command");
+ term_item->generic.icon_name = mate_da_xml_get_string(element, "icon-name");
+
+ term_item->exec_flag = mate_da_xml_get_string(element, "exec-flag");
+
+ capplet->terminals = g_list_append(capplet->terminals, term_item);
+ }
+ else
+ {
+ g_free(executable);
+ }
+ }
+ }
}
- }
- }
- else if (!xmlStrncmp (section->name, (const xmlChar*) "a11y-visual", strlen("a11y-visual"))) {
- for (element = section->children; element != NULL; element = element->next) {
- if (!xmlStrncmp (element->name, (const xmlChar*) "visual", strlen("visual"))) {
- executable = mate_da_xml_get_string (element,"executable");
- if (is_executable_valid (executable)) {
- visual_item = mate_da_visual_item_new ();
-
- visual_item->generic.name = mate_da_xml_get_string (element, "name");
- visual_item->generic.executable = executable;
- visual_item->generic.command = mate_da_xml_get_string (element, "command");
- visual_item->generic.icon_name = mate_da_xml_get_string (element, "icon-name");
-
- visual_item->run_at_startup = mate_da_xml_get_bool (element, "run-at-startup");
-
- capplet->visual_ats = g_list_append (capplet->visual_ats, visual_item);
- }
- else
- g_free (executable);
+ else if (!xmlStrncmp(section->name, (const xmlChar*) "music-players", strlen("music-players")))
+ {
+ for (element = section->children; element != NULL; element = element->next)
+ {
+ if (!xmlStrncmp (element->name, (const xmlChar*) "music-player", strlen("music-player")))
+ {
+ executable = mate_da_xml_get_string(element, "executable");
+
+ if (is_executable_valid(executable))
+ {
+ media_item = mate_da_simple_item_new();
+
+ media_item->generic.name = mate_da_xml_get_string (element, "name");
+ media_item->generic.executable = executable;
+ media_item->generic.command = mate_da_xml_get_string (element, "command");
+ media_item->generic.icon_name = mate_da_xml_get_string (element, "icon-name");
+
+ media_item->run_in_terminal = mate_da_xml_get_bool (element, "run-in-terminal");
+
+ capplet->media_players = g_list_append (capplet->media_players, media_item);
+ }
+ else
+ {
+ g_free(executable);
+ }
+ }
+ }
}
- }
- }
- else if (!xmlStrncmp (section->name, (const xmlChar*) "a11y-mobility", strlen("a11y-mobility"))) {
- for (element = section->children; element != NULL; element = element->next) {
- if (!xmlStrncmp (element->name, (const xmlChar*) "mobility", strlen("mobility"))) {
- executable = mate_da_xml_get_string (element,"executable");
- if (is_executable_valid (executable)) {
- mobility_item = mate_da_mobility_item_new ();
-
- mobility_item->generic.name = mate_da_xml_get_string (element, "name");
- mobility_item->generic.executable = executable;
- mobility_item->generic.command = mate_da_xml_get_string (element, "command");
- mobility_item->generic.icon_name = mate_da_xml_get_string (element, "icon-name");
-
- mobility_item->run_at_startup = mate_da_xml_get_bool (element, "run-at-startup");
-
- capplet->mobility_ats = g_list_append (capplet->mobility_ats, mobility_item);
- }
- else
- g_free (executable);
+ else if (!xmlStrncmp(section->name, (const xmlChar*) "image-viewers", strlen("image-viewers")))
+ {
+ for (element = section->children; element != NULL; element = element->next)
+ {
+ if (!xmlStrncmp(element->name, (const xmlChar*) "image-viewer", strlen("image-viewer")))
+ {
+ executable = mate_da_xml_get_string(element, "executable");
+
+ if (is_executable_valid(executable))
+ {
+ image_item = mate_da_image_item_new();
+
+ image_item->generic.name = mate_da_xml_get_string(element, "name");
+ image_item->generic.executable = executable;
+ image_item->generic.command = mate_da_xml_get_string(element, "command");
+ image_item->generic.icon_name = mate_da_xml_get_string(element, "icon-name");
+
+ image_item->run_in_terminal = mate_da_xml_get_bool(element, "run-in-terminal");
+
+ capplet->image_viewers = g_list_append(capplet->image_viewers, image_item);
+ }
+ else
+ {
+ g_free(executable);
+ }
+ }
+ }
+ }
+ else if (!xmlStrncmp(section->name, (const xmlChar*) "a11y-visual", strlen("a11y-visual")))
+ {
+ for (element = section->children; element != NULL; element = element->next)
+ {
+ if (!xmlStrncmp (element->name, (const xmlChar*) "visual", strlen("visual")))
+ {
+ executable = mate_da_xml_get_string (element,"executable");
+
+ if (is_executable_valid (executable))
+ {
+ visual_item = mate_da_visual_item_new();
+
+ visual_item->generic.name = mate_da_xml_get_string(element, "name");
+ visual_item->generic.executable = executable;
+ visual_item->generic.command = mate_da_xml_get_string(element, "command");
+ visual_item->generic.icon_name = mate_da_xml_get_string(element, "icon-name");
+
+ visual_item->run_at_startup = mate_da_xml_get_bool(element, "run-at-startup");
+
+ capplet->visual_ats = g_list_append(capplet->visual_ats, visual_item);
+ }
+ else
+ {
+ g_free(executable);
+ }
+ }
+ }
+ }
+ else if (!xmlStrncmp(section->name, (const xmlChar*) "a11y-mobility", strlen("a11y-mobility")))
+ {
+ for (element = section->children; element != NULL; element = element->next)
+ {
+ if (!xmlStrncmp(element->name, (const xmlChar*) "mobility", strlen("mobility")))
+ {
+ executable = mate_da_xml_get_string(element,"executable");
+
+ if (is_executable_valid (executable))
+ {
+ mobility_item = mate_da_mobility_item_new ();
+
+ mobility_item->generic.name = mate_da_xml_get_string (element, "name");
+ mobility_item->generic.executable = executable;
+ mobility_item->generic.command = mate_da_xml_get_string (element, "command");
+ mobility_item->generic.icon_name = mate_da_xml_get_string (element, "icon-name");
+
+ mobility_item->run_at_startup = mate_da_xml_get_bool (element, "run-at-startup");
+
+ capplet->mobility_ats = g_list_append (capplet->mobility_ats, mobility_item);
+ }
+ else
+ {
+ g_free (executable);
+ }
+ }
+ }
}
- }
}
- }
- xmlFreeDoc (xml_doc);
+ xmlFreeDoc(xml_doc);
}
void mate_da_xml_load_list(MateDACapplet* capplet)
@@ -314,6 +387,7 @@ void mate_da_xml_free(MateDACapplet* capplet)
g_list_foreach(capplet->visual_ats, (GFunc) mate_da_visual_item_free, NULL);
g_list_foreach(capplet->mobility_ats, (GFunc) mate_da_mobility_item_free, NULL);
//g_list_foreach(capplet->filemanagers, (GFunc) mate_da_filemanager_item_free, NULL);
+ g_list_foreach(capplet->image_viewers, (GFunc) mate_da_image_item_free, NULL);
g_list_free(capplet->web_browsers);
g_list_free(capplet->mail_readers);
@@ -321,6 +395,7 @@ void mate_da_xml_free(MateDACapplet* capplet)
g_list_free(capplet->media_players);
g_list_free(capplet->visual_ats);
g_list_free(capplet->mobility_ats);
+ g_list_free(capplet->image_viewers);
//g_list_free(capplet->filemanagers);
g_object_unref(capplet->builder);
diff --git a/capplets/default-applications/mate-da-xml.h b/capplets/default-applications/mate-da-xml.h
index b209355c..2016b930 100644
--- a/capplets/default-applications/mate-da-xml.h
+++ b/capplets/default-applications/mate-da-xml.h
@@ -21,7 +21,7 @@
#ifndef _MATE_DA_XML_H_
#define _MATE_DA_XML_H_
-void mate_da_xml_load_list (MateDACapplet *capplet);
-void mate_da_xml_free (MateDACapplet *capplet);
+void mate_da_xml_load_list(MateDACapplet* capplet);
+void mate_da_xml_free(MateDACapplet* capplet);
#endif
diff --git a/capplets/default-applications/mate-default-applications.xml.in b/capplets/default-applications/mate-default-applications.xml.in
index 616912e9..b4c1c6d7 100644
--- a/capplets/default-applications/mate-default-applications.xml.in
+++ b/capplets/default-applications/mate-default-applications.xml.in
@@ -427,6 +427,46 @@
<run-in-terminal>false</run-in-terminal>
</image-viewer>
+ <image-viewer>
+ <_name>Shotwell</_name>
+ <executable>shotwell</executable>
+ <command>shotwell %s</command>
+ <icon-name>shotwell</icon-name>
+ <run-in-terminal>false</run-in-terminal>
+ </image-viewer>
+
+ <image-viewer>
+ <_name>MComix</_name>
+ <executable>mcomix</executable>
+ <command>mcomix %s</command>
+ <icon-name>mcomix</icon-name>
+ <run-in-terminal>false</run-in-terminal>
+ </image-viewer>
+
+ <image-viewer>
+ <_name>gThumb</_name>
+ <executable>gthumb</executable>
+ <command>gthumb %s</command>
+ <icon-name>gthumb</icon-name>
+ <run-in-terminal>false</run-in-terminal>
+ </image-viewer>
+
+ <image-viewer>
+ <_name>Gwenview</_name>
+ <executable>gwenview</executable>
+ <command>gwenview %s</command>
+ <icon-name>gwenview</icon-name>
+ <run-in-terminal>false</run-in-terminal>
+ </image-viewer>
+
+ <image-viewer>
+ <_name>Ristretto</_name>
+ <executable>ristretto</executable>
+ <command>ristretto %s</command>
+ <icon-name>ristretto</icon-name>
+ <run-in-terminal>false</run-in-terminal>
+ </image-viewer>
+
<!-- se necesita agregar los otros visores -->
</image-viewers>