[Xfce4-commits] <exo:exo-helper-overhaul> Add FileManager support to exo-helper (bug #4445).

Nick Schermer nick at xfce.org
Wed Aug 26 18:44:03 CEST 2009


Updating branch refs/heads/exo-helper-overhaul
         to 4a3b8878bde0e18faae459e1a530bbd0f6c24aee (commit)
       from 48e3c3f52d41cc4da1b5d85d93990e205f5b13a1 (commit)

commit 4a3b8878bde0e18faae459e1a530bbd0f6c24aee
Author: Nick Schermer <nick at xfce.org>
Date:   Wed Aug 26 18:05:16 2009 +0200

    Add FileManager support to exo-helper (bug #4445).
    
    Slightly modified patch provided by Christian Dywan.

 exo-helper/exo-helper-chooser-dialog.c             |   34 +++++++++++++++++++-
 exo-helper/exo-helper-chooser.c                    |    6 +++-
 exo-helper/exo-helper-launcher-dialog.c            |    2 +
 exo-helper/exo-helper.h                            |    1 +
 exo-helper/helpers/Makefile.am                     |    3 ++
 .../{midori.desktop.in.in => Thunar.desktop.in.in} |    8 ++--
 ...midori.desktop.in.in => nautilus.desktop.in.in} |    8 ++--
 ...{midori.desktop.in.in => pcmanfm.desktop.in.in} |    8 ++--
 exo-helper/main.c                                  |    7 +++-
 9 files changed, 61 insertions(+), 16 deletions(-)

diff --git a/exo-helper/exo-helper-chooser-dialog.c b/exo-helper/exo-helper-chooser-dialog.c
index 149efa7..b5bd0e2 100644
--- a/exo-helper/exo-helper-chooser-dialog.c
+++ b/exo-helper/exo-helper-chooser-dialog.c
@@ -95,7 +95,7 @@ exo_helper_chooser_dialog_init (ExoHelperChooserDialog *chooser_dialog)
   GtkWidget      *box;
 
   /* verify category settings */
-  g_assert (EXO_HELPER_N_CATEGORIES == 3);
+  g_assert (EXO_HELPER_N_CATEGORIES == 4);
 
   gtk_dialog_add_button (GTK_DIALOG (chooser_dialog), GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE);
   gtk_dialog_set_has_separator (GTK_DIALOG (chooser_dialog), FALSE);
@@ -210,6 +210,38 @@ exo_helper_chooser_dialog_init (ExoHelperChooserDialog *chooser_dialog)
   gtk_widget_show (vbox);
 
   /*
+     File Manager
+   */
+  frame = g_object_new (GTK_TYPE_FRAME, "border-width", 0, "shadow-type", GTK_SHADOW_NONE, NULL);
+  gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, TRUE, 0);
+  gtk_widget_show (frame);
+
+  label = g_object_new (GTK_TYPE_LABEL, "attributes", attr_list_bold, "label", _("File Manager"), NULL);
+  gtk_frame_set_label_widget (GTK_FRAME (frame), label);
+  gtk_widget_show (label);
+
+  box = g_object_new (GTK_TYPE_VBOX, "border-width", 12, "spacing", 12, NULL);
+  gtk_container_add (GTK_CONTAINER (frame), box);
+  gtk_widget_show (box);
+
+  label = gtk_label_new (_("The preferred File Manager will be used to\n"
+                           "browse the contents of folders."));
+  gtk_misc_set_alignment (GTK_MISC (label), 0.0f, 0.0f);
+  gtk_box_pack_start (GTK_BOX (box), label, FALSE, FALSE, 0);
+  gtk_widget_show (label);
+
+  chooser = exo_helper_chooser_new (EXO_HELPER_FILEMANAGER);
+  gtk_box_pack_start (GTK_BOX (box), chooser, FALSE, FALSE, 0);
+  gtk_widget_show (chooser);
+
+  /* set Atk label relation for the chooser */
+  object = gtk_widget_get_accessible (chooser);
+  relations = atk_object_ref_relation_set (gtk_widget_get_accessible (label));
+  relation = atk_relation_new (&object, 1, ATK_RELATION_LABEL_FOR);
+  atk_relation_set_add (relations, relation);
+  g_object_unref (G_OBJECT (relation));
+
+  /*
      Terminal Emulator
    */
   frame = g_object_new (GTK_TYPE_FRAME, "border-width", 0, "shadow-type", GTK_SHADOW_NONE, NULL);
diff --git a/exo-helper/exo-helper-chooser.c b/exo-helper/exo-helper-chooser.c
index 6307756..501f6c5 100644
--- a/exo-helper/exo-helper-chooser.c
+++ b/exo-helper/exo-helper-chooser.c
@@ -315,6 +315,7 @@ menu_activate (GtkWidget        *item,
   {
     N_("Failed to set default Web Browser"),
     N_("Failed to set default Mail Reader"),
+    N_("Failed to set default File Manager"),
     N_("Failed to set default Terminal Emulator"),
   };
 
@@ -500,6 +501,7 @@ menu_activate_other (GtkWidget        *item,
   {
     N_("Choose a custom Web Browser"),
     N_("Choose a custom Mail Reader"),
+    N_("Choose a custom File Manager"),
     N_("Choose a custom Terminal Emulator"),
   };
 
@@ -507,6 +509,7 @@ menu_activate_other (GtkWidget        *item,
   {
     N_("Specify the application you want to use\nas default Web Browser for Xfce:"),
     N_("Specify the application you want to use\nas default Mail Reader for Xfce:"),
+    N_("Specify the application you want to use\nas default File Manager for Xfce:"),
     N_("Specify the application you want to use\nas default Terminal Emulator for Xfce:"),
   };
 
@@ -522,7 +525,8 @@ menu_activate_other (GtkWidget        *item,
   GtkWidget   *button;
 
   /* sanity check the category values */
-  g_assert (EXO_HELPER_N_CATEGORIES == 3);
+  g_assert (EXO_HELPER_N_CATEGORIES == G_N_ELEMENTS (BROWSE_TITLES));
+  g_assert (EXO_HELPER_N_CATEGORIES == G_N_ELEMENTS (BROWSE_MESSAGES));
 
   toplevel = gtk_widget_get_toplevel (GTK_WIDGET (chooser));
 
diff --git a/exo-helper/exo-helper-launcher-dialog.c b/exo-helper/exo-helper-launcher-dialog.c
index 480941b..df3cef4 100644
--- a/exo-helper/exo-helper-launcher-dialog.c
+++ b/exo-helper/exo-helper-launcher-dialog.c
@@ -258,6 +258,8 @@ exo_helper_launcher_dialog_set_category (ExoHelperLauncherDialog *launcher_dialo
        "Browser now and click OK to proceed."),
     N_("Please choose your preferred Mail Reader\n"
        "now and click OK to proceed."),
+    N_("Please choose your preferred File Manager\n"
+       "now and click OK to proceed."),
     N_("Please choose your preferred Terminal\n"
        "Emulator now and click OK to proceed."),
   };
diff --git a/exo-helper/exo-helper.h b/exo-helper/exo-helper.h
index 5b9da53..dbef46b 100644
--- a/exo-helper/exo-helper.h
+++ b/exo-helper/exo-helper.h
@@ -28,6 +28,7 @@ typedef enum /*< enum,prefix=EXO_HELPER >*/
 {
   EXO_HELPER_WEBBROWSER,        /*< nick=WebBrowser >*/
   EXO_HELPER_MAILREADER,        /*< nick=MailReader >*/
+  EXO_HELPER_FILEMANAGER,       /*< nick=FileManager >*/
   EXO_HELPER_TERMINALEMULATOR,  /*< nick=TerminalEmulator >*/
   EXO_HELPER_N_CATEGORIES,      /*< skip >*/
 } ExoHelperCategory;
diff --git a/exo-helper/helpers/Makefile.am b/exo-helper/helpers/Makefile.am
index f194b48..839ef68 100644
--- a/exo-helper/helpers/Makefile.am
+++ b/exo-helper/helpers/Makefile.am
@@ -6,6 +6,7 @@ defaults_DATA = helpers.rc
 desktopdir = $(datadir)/xfce4/helpers
 desktop_in_in_files =							\
 	Terminal.desktop.in.in						\
+	Thunar.desktop.in.in						\
 	aterm.desktop.in.in						\
 	balsa.desktop.in.in						\
 	debian-sensible-browser.desktop.in.in				\
@@ -25,10 +26,12 @@ desktop_in_in_files =							\
 	mozilla-browser.desktop.in.in					\
 	mozilla-mailer.desktop.in.in					\
 	mutt.desktop.in.in						\
+	nautilus.desktop.in.in						\
 	netscape-navigator.desktop.in.in				\
 	nxterm.desktop.in.in						\
 	opera-browser.desktop.in.in					\
 	opera-mailer.desktop.in.in					\
+	pcmanfm.desktop.in.in						\
 	sylpheed.desktop.in.in						\
 	sylpheed-claws.desktop.in.in					\
 	thunderbird.desktop.in.in					\
diff --git a/exo-helper/helpers/midori.desktop.in.in b/exo-helper/helpers/Thunar.desktop.in.in
similarity index 64%
copy from exo-helper/helpers/midori.desktop.in.in
copy to exo-helper/helpers/Thunar.desktop.in.in
index 0c26940..07971e3 100644
--- a/exo-helper/helpers/midori.desktop.in.in
+++ b/exo-helper/helpers/Thunar.desktop.in.in
@@ -2,11 +2,11 @@
 [Desktop Entry]
 Encoding=UTF-8
 Version=1.0
-Icon=midori
+Icon=Thunar
 Type=X-XFCE-Helper
-_Name=Midori
+_Name=Thunar
 StartupNotify=true
-X-XFCE-Binaries=midori;
-X-XFCE-Category=WebBrowser
+X-XFCE-Binaries=Thunar;
+X-XFCE-Category=FileManager
 X-XFCE-Commands=%B;
 X-XFCE-CommandsWithParameter=%B "%s";
diff --git a/exo-helper/helpers/midori.desktop.in.in b/exo-helper/helpers/nautilus.desktop.in.in
similarity index 62%
copy from exo-helper/helpers/midori.desktop.in.in
copy to exo-helper/helpers/nautilus.desktop.in.in
index 0c26940..f4c79c6 100644
--- a/exo-helper/helpers/midori.desktop.in.in
+++ b/exo-helper/helpers/nautilus.desktop.in.in
@@ -2,11 +2,11 @@
 [Desktop Entry]
 Encoding=UTF-8
 Version=1.0
-Icon=midori
+Icon=nautilus
 Type=X-XFCE-Helper
-_Name=Midori
+_Name=Nautilus
 StartupNotify=true
-X-XFCE-Binaries=midori;
-X-XFCE-Category=WebBrowser
+X-XFCE-Binaries=nautilus;
+X-XFCE-Category=FileManager
 X-XFCE-Commands=%B;
 X-XFCE-CommandsWithParameter=%B "%s";
diff --git a/exo-helper/helpers/midori.desktop.in.in b/exo-helper/helpers/pcmanfm.desktop.in.in
similarity index 60%
copy from exo-helper/helpers/midori.desktop.in.in
copy to exo-helper/helpers/pcmanfm.desktop.in.in
index 0c26940..2c44a8b 100644
--- a/exo-helper/helpers/midori.desktop.in.in
+++ b/exo-helper/helpers/pcmanfm.desktop.in.in
@@ -2,11 +2,11 @@
 [Desktop Entry]
 Encoding=UTF-8
 Version=1.0
-Icon=midori
+Icon=pcmanfm
 Type=X-XFCE-Helper
-_Name=Midori
+_Name=PCMan File Manager
 StartupNotify=true
-X-XFCE-Binaries=midori;
-X-XFCE-Category=WebBrowser
+X-XFCE-Binaries=pcmanfm;
+X-XFCE-Category=FileManager
 X-XFCE-Commands=%B;
 X-XFCE-CommandsWithParameter=%B "%s";
diff --git a/exo-helper/main.c b/exo-helper/main.c
index 1a3c992..bfd6336 100644
--- a/exo-helper/main.c
+++ b/exo-helper/main.c
@@ -41,6 +41,7 @@ static const gchar *CATEGORY_EXEC_ERRORS[] =
 {
   N_("Failed to execute default Web Browser"),
   N_("Failed to execute default Mail Reader"),
+  N_("Failed to execute default File Manager"),
   N_("Failed to execute default Terminal Emulator"),
 };
 
@@ -86,13 +87,15 @@ main (int argc, char **argv)
   g_option_context_add_group (opt_ctx, gtk_option_group);
 
   g_option_context_add_main_entries (opt_ctx, option_entries, NULL);
-  /* Note to Translators: Do not translate the TYPEs (WebBrowser, MailReader, TerminalEmulator),
-   * since the exo-helper utility will not accept localized TYPEs.
+  /* Note to Translators: Do not translate the TYPEs (WebBrowser, MailReader,
+   * FileManager and TerminalEmulator), since the exo-helper utility will
+   * not accept localized TYPEs.
    */
   g_option_context_set_description (opt_ctx,
                                     _("The following TYPEs are supported for the --launch command:\n\n"
                                       "  WebBrowser       - The preferred Web Browser.\n"
                                       "  MailReader       - The preferred Mail Reader.\n"
+                                      "  FileManager      - The preferred File Manager.\n"
                                       "  TerminalEmulator - The preferred Terminal Emulator."));
 
   if (!g_option_context_parse (opt_ctx, &argc, &argv, &error))



More information about the Xfce4-commits mailing list