Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/Remmina/Remmina.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAntenore Gatta <antenore@simbiosi.org>2018-09-24 18:32:53 +0300
committerAntenore Gatta <antenore@simbiosi.org>2018-09-24 18:32:53 +0300
commitb61cf08eb7958cf3d14c4b69b89ad65899e4b168 (patch)
tree440757336686905da2261e97aa4f30ef5a315c3c /src
parentd0f26c30f13b3b7d57723de1f9749274321a8bc3 (diff)
Screenshots custom file name
Diffstat (limited to 'src')
-rw-r--r--src/remmina_connection_window.c40
-rw-r--r--src/remmina_pref.c7
-rw-r--r--src/remmina_pref.h1
-rw-r--r--src/remmina_pref_dialog.c7
-rw-r--r--src/remmina_pref_dialog.h1
5 files changed, 40 insertions, 16 deletions
diff --git a/src/remmina_connection_window.c b/src/remmina_connection_window.c
index 3449542f2..25c2d4cf2 100644
--- a/src/remmina_connection_window.c
+++ b/src/remmina_connection_window.c
@@ -54,6 +54,7 @@
#include "remmina_protocol_widget.h"
#include "remmina_public.h"
#include "remmina_scrolled_viewport.h"
+#include "remmina_utils.h"
#include "remmina_widget_pool.h"
#include "remmina_log.h"
#include "remmina/remmina_trace_calls.h"
@@ -1767,9 +1768,8 @@ static void remmina_connection_holder_toolbar_screenshot(GtkWidget* widget, Remm
GdkWindow *active_window;
cairo_t *cr;
gint width, height;
- const gchar* remminafile;
+ GString *pngstr;
gchar* pngname;
- gchar* pngdate;
GtkWidget* dialog;
RemminaProtocolWidget *gp;
RemminaPluginScreenshotData rpsd;
@@ -1851,22 +1851,30 @@ static void remmina_connection_holder_toolbar_screenshot(GtkWidget* widget, Remm
}
- remminafile = remmina_file_get_filename(cnnobj->remmina_file);
- //imagedir = g_get_user_special_dir(G_USER_DIRECTORY_PICTURES);
- /** @todo Improve file name (DONE:8743571d) + give the user the option */
- pngdate = g_strdup_printf("%d-%d-%d-%d:%d:%f",
- g_date_time_get_year(date),
- g_date_time_get_month(date),
- g_date_time_get_day_of_month(date),
- g_date_time_get_hour(date),
- g_date_time_get_minute(date),
- g_date_time_get_seconds(date));
+ //home/antenore/Pictures/remmina_%p_%h_%Y %m %d-%H%M%S.png pngname
+ //home/antenore/Pictures/remmina_st_ _2018 9 24-151958.240374.png
+ pngstr = g_string_new(g_strdup_printf("%s/%s.png",
+ remmina_pref.screenshot_path,
+ remmina_pref.screenshot_name));
+ remmina_utils_string_replace_all(pngstr, "%p",
+ remmina_file_get_string(cnnobj->remmina_file, "name"));
+ remmina_utils_string_replace_all(pngstr, "%h",
+ remmina_file_get_string(cnnobj->remmina_file, "server"));
+ remmina_utils_string_replace_all(pngstr, "%Y",
+ g_strdup_printf("%d", g_date_time_get_year(date)));
+ remmina_utils_string_replace_all(pngstr, "%m", g_strdup_printf("%d",
+ g_date_time_get_month(date)));
+ remmina_utils_string_replace_all(pngstr, "%d",
+ g_strdup_printf("%d", g_date_time_get_day_of_month(date)));
+ remmina_utils_string_replace_all(pngstr, "%H",
+ g_strdup_printf("%d", g_date_time_get_hour(date)));
+ remmina_utils_string_replace_all(pngstr, "%M",
+ g_strdup_printf("%d", g_date_time_get_minute(date)));
+ remmina_utils_string_replace_all(pngstr, "%S",
+ g_strdup_printf("%f", g_date_time_get_seconds(date)));
g_date_time_unref(date);
- if (remminafile == NULL)
- remminafile = "remmina_screenshot";
- pngname = g_strdup_printf("%s/%s-%s.png", remmina_pref.screenshot_path,
- g_path_get_basename(remminafile), pngdate);
+ pngname = g_string_free(pngstr, FALSE);
cairo_surface_write_to_png(surface, pngname);
diff --git a/src/remmina_pref.c b/src/remmina_pref.c
index 070a50765..35cb22e86 100644
--- a/src/remmina_pref.c
+++ b/src/remmina_pref.c
@@ -407,6 +407,12 @@ void remmina_pref_init(void)
remmina_pref.screenshot_path = g_get_home_dir();
}
+ if (g_key_file_has_key(gkeyfile, "remmina_pref", "screenshot_name", NULL)) {
+ remmina_pref.screenshot_name = g_key_file_get_string(gkeyfile, "remmina_pref", "screenshot_name", NULL);
+ }else{
+ remmina_pref.screenshot_name = g_strdup("remmina_%p_%h_%Y%m%d-%H%M%S");
+ }
+
if (g_key_file_has_key(gkeyfile, "remmina_pref", "ssh_parseconfig", NULL))
remmina_pref.ssh_parseconfig = g_key_file_get_boolean(gkeyfile, "remmina_pref", "ssh_parseconfig", NULL);
else
@@ -677,6 +683,7 @@ gboolean remmina_pref_save(void)
g_key_file_set_integer(gkeyfile, "remmina_pref", "scale_quality", remmina_pref.scale_quality);
g_key_file_set_integer(gkeyfile, "remmina_pref", "ssh_loglevel", remmina_pref.ssh_loglevel);
g_key_file_set_string(gkeyfile, "remmina_pref", "screenshot_path", remmina_pref.screenshot_path);
+ g_key_file_set_string(gkeyfile, "remmina_pref", "screenshot_name", remmina_pref.screenshot_name);
g_key_file_set_boolean(gkeyfile, "remmina_pref", "ssh_parseconfig", remmina_pref.ssh_parseconfig);
g_key_file_set_boolean(gkeyfile, "remmina_pref", "hide_toolbar", remmina_pref.hide_toolbar);
g_key_file_set_boolean(gkeyfile, "remmina_pref", "hide_statusbar", remmina_pref.hide_statusbar);
diff --git a/src/remmina_pref.h b/src/remmina_pref.h
index 3ad5707d9..c9cd2ebc6 100644
--- a/src/remmina_pref.h
+++ b/src/remmina_pref.h
@@ -114,6 +114,7 @@ typedef struct _RemminaPref {
gint default_action;
gint scale_quality;
const gchar *screenshot_path;
+ const gchar *screenshot_name;
gint auto_scroll_step;
gint recent_maximum;
gchar *resolutions;
diff --git a/src/remmina_pref_dialog.c b/src/remmina_pref_dialog.c
index 78f0da06c..0ab353bfe 100644
--- a/src/remmina_pref_dialog.c
+++ b/src/remmina_pref_dialog.c
@@ -183,6 +183,7 @@ void remmina_pref_on_dialog_destroy(GtkWidget *widget, gpointer user_data)
remmina_pref.show_menu_icons = gtk_combo_box_get_active(remmina_pref_dialog->comboboxtext_appearance_show_menu_icons);
remmina_pref.scale_quality = gtk_combo_box_get_active(remmina_pref_dialog->comboboxtext_options_scale_quality);
remmina_pref.screenshot_path = gtk_file_chooser_get_filename(remmina_pref_dialog->filechooserbutton_options_screenshots_path);
+ remmina_pref.screenshot_name = gtk_entry_get_text(remmina_pref_dialog->entry_options_screenshot_name);
remmina_pref.ssh_loglevel = gtk_combo_box_get_active(remmina_pref_dialog->comboboxtext_options_ssh_loglevel);
remmina_pref.sshtunnel_port = atoi(gtk_entry_get_text(remmina_pref_dialog->entry_options_ssh_port));
if (remmina_pref.sshtunnel_port <= 0)
@@ -512,6 +513,11 @@ static void remmina_pref_dialog_init(void)
}else{
gtk_file_chooser_set_filename(remmina_pref_dialog->filechooserbutton_options_screenshots_path, g_get_home_dir());
}
+ if (remmina_pref.screenshot_name != NULL) {
+ gtk_entry_set_text(remmina_pref_dialog->entry_options_screenshot_name, remmina_pref.screenshot_name);
+ }else{
+ gtk_entry_set_text(remmina_pref_dialog->entry_options_screenshot_name, "remmina_%p_%h_%Y%m%d-%H%M%S");
+ }
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(remmina_pref_dialog->checkbutton_options_ssh_parseconfig), remmina_pref.ssh_parseconfig);
remmina_pref_dialog_set_button_label(remmina_pref_dialog->button_keyboard_copy, remmina_pref.vte_shortcutkey_copy);
@@ -556,6 +562,7 @@ GtkDialog* remmina_pref_dialog_new(gint default_tab, GtkWindow *parent)
remmina_pref_dialog->checkbutton_options_ssh_parseconfig = GTK_CHECK_BUTTON(GET_OBJECT("checkbutton_options_ssh_parseconfig"));
remmina_pref_dialog->comboboxtext_options_ssh_loglevel = GTK_COMBO_BOX(GET_OBJECT("comboboxtext_options_ssh_loglevel"));
remmina_pref_dialog->filechooserbutton_options_screenshots_path = GTK_FILE_CHOOSER(GET_OBJECT("filechooserbutton_options_screenshots_path"));
+ remmina_pref_dialog->entry_options_screenshot_name = GTK_ENTRY(GET_OBJECT("entry_options_screenshot_name"));
remmina_pref_dialog->entry_options_ssh_port = GTK_ENTRY(GET_OBJECT("entry_options_ssh_port"));
remmina_pref_dialog->entry_options_ssh_tcp_keepidle = GTK_ENTRY(GET_OBJECT("entry_options_ssh_tcp_keepidle"));
remmina_pref_dialog->entry_options_ssh_tcp_keepintvl = GTK_ENTRY(GET_OBJECT("entry_options_ssh_tcp_keepintvl"));
diff --git a/src/remmina_pref_dialog.h b/src/remmina_pref_dialog.h
index cc5f52905..f22c35090 100644
--- a/src/remmina_pref_dialog.h
+++ b/src/remmina_pref_dialog.h
@@ -64,6 +64,7 @@ typedef struct _RemminaPrefDialog {
GtkComboBox *comboboxtext_options_ssh_loglevel;
GtkComboBox *comboboxtext_appearance_fullscreen_toolbar_visibility;
GtkFileChooser *filechooserbutton_options_screenshots_path;
+ GtkEntry *entry_options_screenshot_name;
GtkCheckButton *checkbutton_options_ssh_parseconfig;
GtkEntry *entry_options_ssh_port;
GtkEntry *entry_options_ssh_tcp_keepidle;