[gnome-commander] Display a warning if xdg-email is used and more than one file is selected to be send
- From: Uwe Scholz <uwescholz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-commander] Display a warning if xdg-email is used and more than one file is selected to be send
- Date: Tue, 19 May 2020 19:40:16 +0000 (UTC)
commit ab732907cf33a9e38f73464203a992c37754bdf7
Author: Uwe Scholz <u scholz83 gmx de>
Date: Tue May 19 20:17:48 2020 +0200
Display a warning if xdg-email is used and more than one file is selected to be send
src/gnome-cmd-user-actions.cc | 23 +++++++++++++++++++++++
src/gnome-cmd-user-actions.h | 2 ++
2 files changed, 25 insertions(+)
---
diff --git a/src/gnome-cmd-user-actions.cc b/src/gnome-cmd-user-actions.cc
index 9e370373..db5ff8da 100644
--- a/src/gnome-cmd-user-actions.cc
+++ b/src/gnome-cmd-user-actions.cc
@@ -62,6 +62,7 @@ struct _GcmdUserActionSettings
GObject parent;
GSettings *filter;
GSettings *general;
+ GSettings *programs;
};
G_DEFINE_TYPE (GcmdUserActionSettings, gcmd_user_action_settings, G_TYPE_OBJECT)
@@ -76,6 +77,7 @@ static void gcmd_user_action_settings_dispose (GObject *object)
GcmdUserActionSettings *gs = GCMD_USER_ACTIONS (object);
g_clear_object (&gs->general);
+ g_clear_object (&gs->programs);
G_OBJECT_CLASS (gcmd_user_action_settings_parent_class)->dispose (object);
}
@@ -105,6 +107,9 @@ static void gcmd_user_action_settings_init (GcmdUserActionSettings *gs)
global_schema = g_settings_schema_source_lookup (global_schema_source, GCMD_PREF_GENERAL, FALSE);
gs->general = g_settings_new_full (global_schema, NULL, NULL);
+
+ global_schema = g_settings_schema_source_lookup (global_schema_source, GCMD_PREF_PROGRAMS, FALSE);
+ gs->programs = g_settings_new_full (global_schema, NULL, NULL);
}
/***********************************
@@ -876,6 +881,8 @@ void file_sendto (GtkMenuItem *menuitem, gpointer not_used)
gchar **argv = nullptr;
GError *error = nullptr;
+ eventually_warn_if_xdg_email_is_used();
+
DEBUG ('g', "Invoking 'Send files': %s\n", commandString.c_str());
g_shell_parse_argv (commandString.c_str(), &argc, &argv, nullptr);
@@ -888,6 +895,22 @@ void file_sendto (GtkMenuItem *menuitem, gpointer not_used)
}
+void eventually_warn_if_xdg_email_is_used()
+{
+ auto fileList = get_fl (ACTIVE);
+ GList *selectedFileList = fileList->get_selected_files();
+ auto currentSendToString = g_settings_get_string (gcmd_user_actions.settings->programs,
GCMD_SETTINGS_SENDTO_CMD);
+
+ if ((g_strcmp0(currentSendToString, "xdg-email --attach %s") == 0)
+ && g_list_length(selectedFileList) > 1)
+ {
+ gnome_cmd_show_message (*main_win, _("Warning"), _("The default send-to command only supports one
selected file at a time. You can change the command in the program options."));
+ }
+ g_list_free(selectedFileList);
+ g_free(currentSendToString);
+}
+
+
void file_properties (GtkMenuItem *menuitem, gpointer not_used)
{
gnome_cmd_file_list_show_properties_dialog (get_fl (ACTIVE));
diff --git a/src/gnome-cmd-user-actions.h b/src/gnome-cmd-user-actions.h
index 9a1c62e2..4da3a28a 100644
--- a/src/gnome-cmd-user-actions.h
+++ b/src/gnome-cmd-user-actions.h
@@ -213,6 +213,8 @@ inline gboolean GnomeCmdUserActions::register_action(guint keyval, const gchar *
int parse_command(string *cmd, const gchar *command);
+void eventually_warn_if_xdg_email_is_used();
+
extern GnomeCmdUserActions gcmd_user_actions;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]