summaryrefslogtreecommitdiff
path: root/exo-helper
diff options
context:
space:
mode:
authorNick Schermer <nick@xfce.org>2009-08-29 21:46:34 +0200
committerNick Schermer <nick@xfce.org>2009-08-29 21:46:34 +0200
commitce3c2d6606f856b4f0bebad286e0825d1622fc7f (patch)
treeab1e084e593b11c75f13c1afa09f0721f98e5e37 /exo-helper
parent6764461a5357e2901430ebe4e01c2f43acb3fe16 (diff)
downloadexo-ce3c2d6606f856b4f0bebad286e0825d1622fc7f.tar.gz
Squashed commit of the following:
commit c89f6932db63a37827ef5c05e06002d2eeb151ad Author: Nick Schermer <nick@xfce.org> Date: Thu Aug 27 20:17:00 2009 +0200 Strip the mailto: part from an uri since we work with mailto:%s in the desktop files. commit 8d82d52e199b8dfc8ef99763d203daaa6c4ed688 Author: Nick Schermer <nick@xfce.org> Date: Wed Aug 26 22:46:47 2009 +0200 Fix distcheck with external gio module. commit a8c711840c69e434ea7b436cc9c84444328faadd Author: Nick Schermer <nick@xfce.org> Date: Wed Aug 26 22:34:04 2009 +0200 Update POTFILES.in. commit 3167524eae1b5dfacb3c4c6dc7adfe53f5f0b2e4 Author: Nick Schermer <nick@xfce.org> Date: Wed Aug 26 19:11:31 2009 +0200 Use -compose for thunderbird (bug #4496). commit d72abb5d58b217a60fde7755f1102f1658747d39 Author: Nick Schermer <nick@xfce.org> Date: Wed Aug 26 18:44:35 2009 +0200 Add gopher to the known browser URI schemes (bug #4497). commit 41b0c2a5d33f51195f0a01d9154b099f0a9cdc61 Author: Nick Schermer <nick@xfce.org> Date: Wed Aug 26 18:42:01 2009 +0200 Update docs. commit d28a218994ae1b7ca3553a864a1ab28312141ab2 Author: Nick Schermer <nick@xfce.org> Date: Wed Aug 26 18:38:26 2009 +0200 Update python bindings. commit e09d4bcc06dcd32a135b98b2ddca98e5d2e4e079 Author: Nick Schermer <nick@xfce.org> Date: Wed Aug 26 18:37:03 2009 +0200 Remove exo-url functions and move dialog hook to gtk extensions. commit c07a72487229b8ab3b75326dd1a29211b9455914 Author: Nick Schermer <nick@xfce.org> Date: Wed Aug 26 18:09:09 2009 +0200 Add FileManager support to exo-open and known URI completion. Move some code from exo-url to exo-open to complete non-uris when passing for example some filenames to exo-open. commit a16361e2f7684ac84d9e80008969e3a7db5a5838 Author: Nick Schermer <nick@xfce.org> Date: Wed Aug 26 18:08:10 2009 +0200 Iterate the mainloop so the dialog is fully destroyed before executing. commit 4a3b8878bde0e18faae459e1a530bbd0f6c24aee Author: Nick Schermer <nick@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. commit 48e3c3f52d41cc4da1b5d85d93990e205f5b13a1 Author: Nick Schermer <nick@xfce.org> Date: Wed Aug 26 18:02:02 2009 +0200 Add a GIO module to handle known exo helper URIs.
Diffstat (limited to 'exo-helper')
-rw-r--r--exo-helper/exo-helper-chooser-dialog.c34
-rw-r--r--exo-helper/exo-helper-chooser.c6
-rw-r--r--exo-helper/exo-helper-launcher-dialog.c2
-rw-r--r--exo-helper/exo-helper.c31
-rw-r--r--exo-helper/exo-helper.h1
-rw-r--r--exo-helper/helpers/Makefile.am3
-rw-r--r--exo-helper/helpers/Thunar.desktop.in.in12
-rwxr-xr-xexo-helper/helpers/exo-compose-mail-12
-rw-r--r--exo-helper/helpers/nautilus.desktop.in.in12
-rw-r--r--exo-helper/helpers/pcmanfm.desktop.in.in12
-rw-r--r--exo-helper/main.c11
11 files changed, 108 insertions, 18 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.c b/exo-helper/exo-helper.c
index 28ff320..9a06daa 100644
--- a/exo-helper/exo-helper.c
+++ b/exo-helper/exo-helper.c
@@ -347,17 +347,18 @@ exo_helper_execute (ExoHelper *helper,
const gchar *parameter,
GError **error)
{
- GTimeVal previous;
- GTimeVal current;
- gboolean succeed = FALSE;
- GError *err = NULL;
- gchar **commands;
- gchar **argv;
- gchar *command;
- guint n;
- gint status;
- gint result;
- gint pid;
+ GTimeVal previous;
+ GTimeVal current;
+ gboolean succeed = FALSE;
+ GError *err = NULL;
+ gchar **commands;
+ gchar **argv;
+ gchar *command;
+ guint n;
+ gint status;
+ gint result;
+ gint pid;
+ const gchar *real_parameter = parameter;
// FIXME: startup-notification
@@ -369,8 +370,12 @@ exo_helper_execute (ExoHelper *helper,
if (G_UNLIKELY (screen == NULL))
screen = gdk_screen_get_default ();
+ /* strip the mailto part if needed */
+ if (real_parameter != NULL && g_str_has_prefix (real_parameter, "mailto:"))
+ real_parameter = parameter + 7;
+
/* determine the command set to use */
- commands = (parameter != NULL) ? helper->commands_with_parameter : helper->commands;
+ commands = !exo_str_is_empty (real_parameter) ? helper->commands_with_parameter : helper->commands;
/* verify that we have atleast one command */
if (G_UNLIKELY (*commands == NULL))
@@ -386,7 +391,7 @@ exo_helper_execute (ExoHelper *helper,
g_clear_error (&err);
/* parse the command */
- command = (parameter != NULL) ? exo_str_replace (commands[n], "%s", parameter) : g_strdup (commands[n]);
+ command = !exo_str_is_empty (real_parameter) ? exo_str_replace (commands[n], "%s", real_parameter) : g_strdup (commands[n]);
succeed = g_shell_parse_argv (command, NULL, &argv, &err);
g_free (command);
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/Thunar.desktop.in.in b/exo-helper/helpers/Thunar.desktop.in.in
new file mode 100644
index 0000000..07971e3
--- /dev/null
+++ b/exo-helper/helpers/Thunar.desktop.in.in
@@ -0,0 +1,12 @@
+
+[Desktop Entry]
+Encoding=UTF-8
+Version=1.0
+Icon=Thunar
+Type=X-XFCE-Helper
+_Name=Thunar
+StartupNotify=true
+X-XFCE-Binaries=Thunar;
+X-XFCE-Category=FileManager
+X-XFCE-Commands=%B;
+X-XFCE-CommandsWithParameter=%B "%s";
diff --git a/exo-helper/helpers/exo-compose-mail-1 b/exo-helper/helpers/exo-compose-mail-1
index 8ea65a9..cb41a31 100755
--- a/exo-helper/helpers/exo-compose-mail-1
+++ b/exo-helper/helpers/exo-compose-mail-1
@@ -81,7 +81,7 @@ if ($style eq 'mozilla') {
$body and $command .= ",body='$body'";
# and add the parameters to the argv
- push (@argv, '--compose');
+ push (@argv, '-compose');
push (@argv, $command);
}
elsif ($style eq 'mozilla-remote') {
diff --git a/exo-helper/helpers/nautilus.desktop.in.in b/exo-helper/helpers/nautilus.desktop.in.in
new file mode 100644
index 0000000..f4c79c6
--- /dev/null
+++ b/exo-helper/helpers/nautilus.desktop.in.in
@@ -0,0 +1,12 @@
+
+[Desktop Entry]
+Encoding=UTF-8
+Version=1.0
+Icon=nautilus
+Type=X-XFCE-Helper
+_Name=Nautilus
+StartupNotify=true
+X-XFCE-Binaries=nautilus;
+X-XFCE-Category=FileManager
+X-XFCE-Commands=%B;
+X-XFCE-CommandsWithParameter=%B "%s";
diff --git a/exo-helper/helpers/pcmanfm.desktop.in.in b/exo-helper/helpers/pcmanfm.desktop.in.in
new file mode 100644
index 0000000..2c44a8b
--- /dev/null
+++ b/exo-helper/helpers/pcmanfm.desktop.in.in
@@ -0,0 +1,12 @@
+
+[Desktop Entry]
+Encoding=UTF-8
+Version=1.0
+Icon=pcmanfm
+Type=X-XFCE-Helper
+_Name=PCMan File Manager
+StartupNotify=true
+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..5cbfaf7 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))
@@ -165,6 +168,10 @@ main (int argc, char **argv)
if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK)
helper = exo_helper_database_get_default (database, category);
gtk_widget_destroy (dialog);
+
+ /* iterate the mainloop until the dialog is fully destroyed */
+ while (gtk_events_pending ())
+ gtk_main_iteration ();
}
/* release our reference on the database */