Commit 2df01cda7afbc8aeab9d07db0552a34aaf2d8ba4
1 parent
b9b915f0
Exists in
master
and in
2 other branches
Adding metada to gtkrecentmanager entry.
Showing
3 changed files
with
43 additions
and
1 deletions
Show diff stats
schemas/linux/application.gschema.xml.in
| ... | ... | @@ -75,6 +75,13 @@ |
| 75 | 75 | <description></description> |
| 76 | 76 | </key> |
| 77 | 77 | |
| 78 | + <key name="add-session-to-recent-manager" type="b"> | |
| 79 | + <default>true</default> | |
| 80 | + <summary>Add session file to recent file list</summary> | |
| 81 | + <description></description> | |
| 82 | + </key> | |
| 83 | + | |
| 78 | 84 | </schema> |
| 79 | 85 | |
| 80 | 86 | </schemalist> |
| 87 | + | ... | ... |
schemas/windows/application.gschema.xml.in
| ... | ... | @@ -87,6 +87,13 @@ |
| 87 | 87 | <description></description> |
| 88 | 88 | </key> |
| 89 | 89 | |
| 90 | + <key name="add-session-to-recent-manager" type="b"> | |
| 91 | + <default>true</default> | |
| 92 | + <summary>Add session file to recent file list</summary> | |
| 93 | + <description></description> | |
| 94 | + </key> | |
| 95 | + | |
| 90 | 96 | </schema> |
| 91 | 97 | |
| 92 | 98 | </schemalist> |
| 99 | + | ... | ... |
src/objects/window/keyfile.c
| ... | ... | @@ -28,6 +28,14 @@ |
| 28 | 28 | */ |
| 29 | 29 | |
| 30 | 30 | #include <config.h> |
| 31 | + | |
| 32 | + #ifndef GETTEXT_PACKAGE | |
| 33 | + #define GETTEXT_PACKAGE PACKAGE_NAME | |
| 34 | + #endif | |
| 35 | + | |
| 36 | + #include <libintl.h> | |
| 37 | + #include <glib/gi18n.h> | |
| 38 | + | |
| 31 | 39 | #include <glib.h> |
| 32 | 40 | #include <glib/gstdio.h> |
| 33 | 41 | #include <fcntl.h> |
| ... | ... | @@ -169,8 +177,28 @@ |
| 169 | 177 | |
| 170 | 178 | } |
| 171 | 179 | |
| 172 | - gtk_recent_manager_add_item(gtk_recent_manager_get_default(),filename); | |
| 180 | + if(settings && g_settings_get_boolean(settings,"add-session-to-recent-manager")) { | |
| 181 | + | |
| 182 | + // new_session->key_file | |
| 183 | + g_autofree gchar * display_name = g_key_file_get_string(new_session->key_file,"terminal","session-name",NULL); | |
| 184 | + | |
| 185 | + GtkRecentData recent_data = { | |
| 173 | 186 | |
| 187 | + .display_name = display_name, | |
| 188 | + .app_name = G_STRINGIFY(PRODUCT_NAME), | |
| 189 | + .description = _("TN3270 Session description"), | |
| 190 | + .mime_type = "application/x-pw3270", | |
| 191 | + .app_exec = G_STRINGIFY(PRODUCT_NAME) " %f", | |
| 192 | + | |
| 193 | + }; | |
| 194 | + | |
| 195 | + gtk_recent_manager_add_full( | |
| 196 | + gtk_recent_manager_get_default(), | |
| 197 | + filename, | |
| 198 | + &recent_data | |
| 199 | + ); | |
| 200 | + | |
| 201 | + } | |
| 174 | 202 | } |
| 175 | 203 | |
| 176 | 204 | ... | ... |