summaryrefslogtreecommitdiff
path: root/capplets
diff options
context:
space:
mode:
authorStefano Karapetsas <[email protected]>2014-05-16 10:47:04 +0200
committerStefano Karapetsas <[email protected]>2014-05-16 10:47:04 +0200
commit097271c479a329cdc53cb0be03e1d8b819344624 (patch)
tree2d0a33f157c929a14a84748d8dd7b9df39057bea /capplets
parente8b4a9dcafee9c8e6a50b403cf6dda0cdb30ebd5 (diff)
downloadmate-control-center-097271c479a329cdc53cb0be03e1d8b819344624.tar.bz2
mate-control-center-097271c479a329cdc53cb0be03e1d8b819344624.tar.xz
default-applications: Add support for office applications
Diffstat (limited to 'capplets')
-rw-r--r--capplets/default-applications/mate-da-capplet.c58
-rw-r--r--capplets/default-applications/mate-da-capplet.h6
-rw-r--r--capplets/default-applications/mate-default-applications-properties.ui224
3 files changed, 286 insertions, 2 deletions
diff --git a/capplets/default-applications/mate-da-capplet.c b/capplets/default-applications/mate-da-capplet.c
index 7461fe0b..e9bcee9d 100644
--- a/capplets/default-applications/mate-da-capplet.c
+++ b/capplets/default-applications/mate-da-capplet.c
@@ -45,6 +45,9 @@ enum {
DA_TYPE_IMAGE,
DA_TYPE_TEXT,
DA_TYPE_FILE,
+ DA_TYPE_DOCUMENT,
+ DA_TYPE_WORD,
+ DA_TYPE_SPREADSHEET,
DA_N_COLUMNS
};
@@ -123,6 +126,22 @@ set_changed(GtkComboBox* combo, MateDACapplet* capplet, GList* list, gint type)
g_app_info_set_as_default_for_type(item, "image/tiff", NULL);
break;
+ case DA_TYPE_DOCUMENT:
+ g_app_info_set_as_default_for_type(item, "application/pdf", NULL);
+ break;
+
+ case DA_TYPE_WORD:
+ g_app_info_set_as_default_for_type(item, "application/vnd.oasis.opendocument.text", NULL);
+ g_app_info_set_as_default_for_type(item, "application/msword", NULL);
+ g_app_info_set_as_default_for_type(item, "application/vnd.openxmlformats-officedocument.wordprocessingml.document", NULL);
+ break;
+
+ case DA_TYPE_SPREADSHEET:
+ g_app_info_set_as_default_for_type(item, "application/vnd.oasis.opendocument.spreadsheet", NULL);
+ g_app_info_set_as_default_for_type(item, "application/vnd.ms-excel", NULL);
+ g_app_info_set_as_default_for_type(item, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", NULL);
+ break;
+
case DA_TYPE_TERMINAL:
g_settings_set_string (capplet->terminal_settings, TERMINAL_KEY, g_app_info_get_executable (item));
break;
@@ -160,6 +179,9 @@ close_cb(GtkWidget* window, gint response, MateDACapplet* capplet)
set_changed(GTK_COMBO_BOX(capplet->visual_combo_box), capplet, capplet->visual_ats, DA_TYPE_VISUAL);
set_changed(GTK_COMBO_BOX(capplet->mobility_combo_box), capplet, capplet->mobility_ats, DA_TYPE_MOBILITY);
set_changed(GTK_COMBO_BOX(capplet->image_combo_box), capplet, capplet->image_viewers, DA_TYPE_IMAGE);
+ set_changed(GTK_COMBO_BOX(capplet->document_combo_box), capplet, capplet->document_viewers, DA_TYPE_DOCUMENT);
+ set_changed(GTK_COMBO_BOX(capplet->word_combo_box), capplet, capplet->word_editors, DA_TYPE_WORD);
+ set_changed(GTK_COMBO_BOX(capplet->spreadsheet_combo_box), capplet, capplet->spreadsheet_editors, DA_TYPE_SPREADSHEET);
gtk_widget_destroy(window);
gtk_main_quit();
@@ -228,6 +250,24 @@ image_combo_changed_cb(GtkComboBox* combo, MateDACapplet* capplet)
}
static void
+document_combo_changed_cb(GtkComboBox* combo, MateDACapplet* capplet)
+{
+ set_changed(combo, capplet, capplet->document_viewers, DA_TYPE_DOCUMENT);
+}
+
+static void
+word_combo_changed_cb(GtkComboBox* combo, MateDACapplet* capplet)
+{
+ set_changed(combo, capplet, capplet->word_editors, DA_TYPE_WORD);
+}
+
+static void
+spreadsheet_combo_changed_cb(GtkComboBox* combo, MateDACapplet* capplet)
+{
+ set_changed(combo, capplet, capplet->spreadsheet_editors, DA_TYPE_SPREADSHEET);
+}
+
+static void
refresh_combo_box_icons(GtkIconTheme* theme, GtkComboBox* combo_box, GList* app_list)
{
GtkTreeIter iter;
@@ -281,6 +321,9 @@ static struct {
{"video_image", "video-x-generic"},
{"text_image", "text-editor"},
{"terminal_image", "terminal"},
+ {"document_image", "application-pdf"},
+ {"word_image", "office-document"},
+ {"spreadsheet_image", "office-spreadsheet"},
};
/* Callback for icon theme change */
@@ -313,6 +356,9 @@ theme_changed_cb(GtkIconTheme* theme, MateDACapplet* capplet)
refresh_combo_box_icons(theme, GTK_COMBO_BOX(capplet->mobility_combo_box), capplet->mobility_ats);
refresh_combo_box_icons(theme, GTK_COMBO_BOX(capplet->file_combo_box), capplet->file_managers);
refresh_combo_box_icons(theme, GTK_COMBO_BOX(capplet->text_combo_box), capplet->text_editors);
+ refresh_combo_box_icons(theme, GTK_COMBO_BOX(capplet->document_combo_box), capplet->document_viewers);
+ refresh_combo_box_icons(theme, GTK_COMBO_BOX(capplet->word_combo_box), capplet->word_editors);
+ refresh_combo_box_icons(theme, GTK_COMBO_BOX(capplet->spreadsheet_combo_box), capplet->spreadsheet_editors);
}
static void
@@ -518,6 +564,9 @@ show_dialog(MateDACapplet* capplet, const gchar* start_page)
capplet->text_combo_box = get_widget("text_combobox");
capplet->file_combo_box = get_widget("filemanager_combobox");
capplet->image_combo_box = get_widget("image_combobox");
+ capplet->document_combo_box = get_widget("document_combobox");
+ capplet->word_combo_box = get_widget("word_combobox");
+ capplet->spreadsheet_combo_box = get_widget("spreadsheet_combobox");
capplet->visual_startup_checkbutton = get_widget("visual_start_checkbutton");
capplet->mobility_startup_checkbutton = get_widget("mobility_start_checkbutton");
@@ -533,6 +582,9 @@ show_dialog(MateDACapplet* capplet, const gchar* start_page)
capplet->text_editors = g_app_info_get_all_for_type("text/plain");
capplet->image_viewers = g_app_info_get_all_for_type("image/png");
capplet->file_managers = g_app_info_get_all_for_type("inode/directory");
+ capplet->document_viewers = g_app_info_get_all_for_type("application/pdf");
+ capplet->word_editors = g_app_info_get_all_for_type("application/vnd.oasis.opendocument.text");
+ capplet->spreadsheet_editors = g_app_info_get_all_for_type("application/vnd.oasis.opendocument.spreadsheet");
capplet->visual_ats = NULL;
capplet->visual_ats = fill_list_from_desktop_file (capplet->visual_ats, APPLICATIONSDIR "/orca.desktop");
@@ -571,6 +623,9 @@ show_dialog(MateDACapplet* capplet, const gchar* start_page)
fill_combo_box(capplet->icon_theme, GTK_COMBO_BOX(capplet->file_combo_box), capplet->file_managers, "inode/directory");
fill_combo_box(capplet->icon_theme, GTK_COMBO_BOX(capplet->visual_combo_box), capplet->visual_ats, "visual");
fill_combo_box(capplet->icon_theme, GTK_COMBO_BOX(capplet->mobility_combo_box), capplet->mobility_ats, "mobility");
+ fill_combo_box(capplet->icon_theme, GTK_COMBO_BOX(capplet->document_combo_box), capplet->document_viewers, "application/pdf");
+ fill_combo_box(capplet->icon_theme, GTK_COMBO_BOX(capplet->word_combo_box), capplet->word_editors, "application/vnd.oasis.opendocument.text");
+ fill_combo_box(capplet->icon_theme, GTK_COMBO_BOX(capplet->spreadsheet_combo_box), capplet->spreadsheet_editors, "application/vnd.oasis.opendocument.spreadsheet");
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);
@@ -582,6 +637,9 @@ show_dialog(MateDACapplet* capplet, const gchar* start_page)
g_signal_connect(capplet->image_combo_box, "changed", G_CALLBACK(image_combo_changed_cb), capplet);
g_signal_connect(capplet->text_combo_box, "changed", G_CALLBACK(text_combo_changed_cb), capplet);
g_signal_connect(capplet->file_combo_box, "changed", G_CALLBACK(file_combo_changed_cb), capplet);
+ g_signal_connect(capplet->document_combo_box, "changed", G_CALLBACK(document_combo_changed_cb), capplet);
+ g_signal_connect(capplet->word_combo_box, "changed", G_CALLBACK(word_combo_changed_cb), capplet);
+ g_signal_connect(capplet->spreadsheet_combo_box, "changed", G_CALLBACK(spreadsheet_combo_changed_cb), capplet);
g_settings_bind (capplet->mobility_settings, MOBILITY_STARTUP_KEY, capplet->mobility_startup_checkbutton, "active", G_SETTINGS_BIND_DEFAULT);
g_settings_bind (capplet->visual_settings, VISUAL_STARTUP_KEY, capplet->visual_startup_checkbutton, "active", G_SETTINGS_BIND_DEFAULT);
diff --git a/capplets/default-applications/mate-da-capplet.h b/capplets/default-applications/mate-da-capplet.h
index cd9f2afc..5a7d7ec0 100644
--- a/capplets/default-applications/mate-da-capplet.h
+++ b/capplets/default-applications/mate-da-capplet.h
@@ -52,6 +52,9 @@ typedef struct _MateDACapplet {
GtkWidget* file_combo_box;
GtkWidget* text_combo_box;
GtkWidget* image_combo_box;
+ GtkWidget* document_combo_box;
+ GtkWidget* word_combo_box;
+ GtkWidget* spreadsheet_combo_box;
/* Web Browser
* at the moment default,new_win,new_tab arent used */
@@ -119,6 +122,9 @@ typedef struct _MateDACapplet {
GList* file_managers;
GList* text_editors;
GList* image_viewers;
+ GList* document_viewers;
+ GList* word_editors;
+ GList* spreadsheet_editors;
/* Settings objects */
GSettings* terminal_settings;
diff --git a/capplets/default-applications/mate-default-applications-properties.ui b/capplets/default-applications/mate-default-applications-properties.ui
index 1b3963a0..d374ccfd 100644
--- a/capplets/default-applications/mate-default-applications-properties.ui
+++ b/capplets/default-applications/mate-default-applications-properties.ui
@@ -714,6 +714,226 @@
<property name="tab_fill">False</property>
</packing>
</child>
+
+ <child>
+ <object class="GtkVBox" id="office_vbox">
+ <property name="visible">True</property>
+ <property name="border_width">12</property>
+ <property name="spacing">18</property>
+
+ <!-- Document Viewer -->
+ <child>
+ <object class="GtkVBox" id="document_vbox">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="document_label">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Document Viewer</property>
+ <attributes>
+ <attribute name="weight" value="bold" />
+ </attributes>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="document_hbox">
+ <property name="visible">True</property>
+ <property name="spacing">12</property>
+ <child>
+ <object class="GtkImage" id="document_image">
+ <property name="visible">True</property>
+ <property name="yalign">0</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="document_options_vbox">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkComboBox" id="document_combobox">
+ <property name="visible">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <!-- / Document Viewer -->
+
+ <!-- Word Processor -->
+ <child>
+ <object class="GtkVBox" id="word_vbox">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="word_label">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Word Processor</property>
+ <attributes>
+ <attribute name="weight" value="bold" />
+ </attributes>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="word_hbox">
+ <property name="visible">True</property>
+ <property name="spacing">12</property>
+ <child>
+ <object class="GtkImage" id="word_image">
+ <property name="visible">True</property>
+ <property name="yalign">0</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="word_options_vbox">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkComboBox" id="word_combobox">
+ <property name="visible">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <!-- / Word Processor -->
+
+ <!-- Spreadsheet Editor -->
+ <child>
+ <object class="GtkVBox" id="spreadsheet_vbox">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="spreadsheet_label">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Spreadsheet Editor</property>
+ <attributes>
+ <attribute name="weight" value="bold" />
+ </attributes>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="spreadsheet_hbox">
+ <property name="visible">True</property>
+ <property name="spacing">12</property>
+ <child>
+ <object class="GtkImage" id="spreadsheet_image">
+ <property name="visible">True</property>
+ <property name="yalign">0</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="spreadsheet_options_vbox">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkComboBox" id="spreadsheet_combobox">
+ <property name="visible">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <!-- / Spreadsheet Editor -->
+ </object>
+ <packing>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ <child type="tab">
+ <object class="GtkLabel" id="office_label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Office</property>
+ </object>
+ <packing>
+ <property name="position">2</property>
+ <property name="tab_fill">False</property>
+ </packing>
+ </child>
+
<child>
<object class="GtkVBox" id="a11y_vbox">
<property name="visible">True</property>
@@ -873,7 +1093,7 @@
</child>
</object>
<packing>
- <property name="position">3</property>
+ <property name="position">4</property>
</packing>
</child>
<child type="tab">
@@ -882,7 +1102,7 @@
<property name="label" translatable="yes">Accessibility</property>
</object>
<packing>
- <property name="position">3</property>
+ <property name="position">4</property>
<property name="tab_fill">False</property>
</packing>
</child>