Branch: refs/heads/master Author: Abdul Rafey 96364226+00AR@users.noreply.github.com Committer: GitHub noreply@github.com Date: Sun, 29 Jan 2023 15:44:17 UTC Commit: 4508f77a1150b37d5e16c3e7fc9c7223bc591e88 https://github.com/geany/geany/commit/4508f77a1150b37d5e16c3e7fc9c7223bc591e...
Log Message: ----------- Make tab label length and window title length configurable (#3365)
Closes #3344 and #2112.
Modified Paths: -------------- data/geany.glade doc/geany.txt src/document.c src/keyfile.c src/plugindata.h src/prefs.c src/ui_utils.c src/ui_utils.h
Modified: data/geany.glade 50 lines changed, 50 insertions(+), 0 deletions(-) =================================================================== @@ -34,6 +34,13 @@ <property name="step-increment">1</property> <property name="page-increment">10</property> </object> + <object class="GtkAdjustment" id="adjustment14"> + <property name="lower">3</property> + <property name="upper">100000</property> + <property name="value">99999</property> + <property name="step-increment">1</property> + <property name="page-increment">10</property> + </object> <object class="GtkAdjustment" id="adjustment2"> <property name="lower">1</property> <property name="upper">99</property> @@ -2193,6 +2200,49 @@ <property name="position">4</property> </packing> </child> + <child> + <!-- n-columns=2 n-rows=1 --> + <object class="GtkGrid"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="column-spacing">10</property> + <child> + <object class="GtkLabel" id="label251"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="tooltip-text" translatable="yes">Set limit on visible characters in tab label.</property> + <property name="label" translatable="yes">Tab label length:</property> + <property name="mnemonic-widget">spin_tab_label_len</property> + </object> + <packing> + <property name="left-attach">0</property> + <property name="top-attach">0</property> + </packing> + </child> + <child> + <object class="GtkSpinButton" id="spin_tab_label_len"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="tooltip-text" translatable="yes">Characters to be visible on the tab label of the file.</property> + <property name="primary-icon-activatable">False</property> + <property name="secondary-icon-activatable">False</property> + <property name="adjustment">adjustment14</property> + <property name="climb-rate">1</property> + <property name="numeric">True</property> + <property name="update-policy">if-valid</property> + </object> + <packing> + <property name="left-attach">1</property> + <property name="top-attach">0</property> + </packing> + </child> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">5</property> + </packing> + </child> </object> </child> </object>
Modified: doc/geany.txt 4 lines changed, 4 insertions(+), 0 deletions(-) =================================================================== @@ -2022,6 +2022,10 @@ Double-clicking hides all additional widgets Whether to call the View->Toggle All Additional Widgets command when double-clicking on a notebook tab.
+Tab label length + If filenames are long, set the number of characters that should be + visible on each tab's label. + Tab positions `````````````
Modified: src/document.c 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -434,7 +434,7 @@ void document_update_tab_label(GeanyDocument *doc)
g_return_if_fail(doc != NULL);
- short_name = document_get_basename_for_display(doc, -1); + short_name = document_get_basename_for_display(doc, interface_prefs.tab_label_len);
/* we need to use the event box for the tooltip, labels don't get the necessary events */ parent = gtk_widget_get_parent(doc->priv->tab_label);
Modified: src/keyfile.c 1 lines changed, 1 insertions(+), 0 deletions(-) =================================================================== @@ -539,6 +539,7 @@ static void save_dialog_prefs(GKeyFile *config) g_key_file_set_boolean(config, PACKAGE, "tab_order_beside", file_prefs.tab_order_beside); g_key_file_set_integer(config, PACKAGE, "tab_pos_editor", interface_prefs.tab_pos_editor); g_key_file_set_integer(config, PACKAGE, "tab_pos_msgwin", interface_prefs.tab_pos_msgwin); + g_key_file_set_integer(config, PACKAGE, "tab_label_length", interface_prefs.tab_label_len);
/* display */ g_key_file_set_boolean(config, PACKAGE, "show_indent_guide", editor_prefs.show_indent_guide);
Modified: src/plugindata.h 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -57,7 +57,7 @@ G_BEGIN_DECLS * @warning You should not test for values below 200 as previously * @c GEANY_API_VERSION was defined as an enum value, not a macro. */ -#define GEANY_API_VERSION 245 +#define GEANY_API_VERSION 246
/* hack to have a different ABI when built with different GTK major versions * because loading plugins linked to a different one leads to crashes.
Modified: src/prefs.c 5 lines changed, 5 insertions(+), 0 deletions(-) =================================================================== @@ -965,6 +965,8 @@ on_prefs_dialog_response(GtkDialog *dialog, gint response, gpointer user_data) widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_statusbar_visible"); interface_prefs.statusbar_visible = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
+ widget = ui_lookup_widget(ui_widgets.prefs_dialog, "spin_tab_label_len"); + interface_prefs.tab_label_len = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
/* Toolbar settings */ widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_toolbar_show"); @@ -1294,6 +1296,8 @@ on_prefs_dialog_response(GtkDialog *dialog, gint response, gpointer user_data) editor_apply_update_prefs(documents[i]->editor); if (! editor_prefs.folding) editor_unfold_all(documents[i]->editor); + + document_update_tab_label(documents[i]); } } ui_document_show_hide(NULL); @@ -1303,6 +1307,7 @@ on_prefs_dialog_response(GtkDialog *dialog, gint response, gpointer user_data) ui_save_buttons_toggle((doc != NULL) ? doc->changed : FALSE); msgwin_show_hide_tabs(); ui_update_statusbar(doc, -1); + ui_set_window_title(doc);
/* store all settings */ configuration_save();
Modified: src/ui_utils.c 4 lines changed, 3 insertions(+), 1 deletions(-) =================================================================== @@ -383,7 +383,7 @@ void ui_set_window_title(GeanyDocument *doc) g_string_append(str, DOC_FILENAME(doc)); else { - gchar *short_name = document_get_basename_for_display(doc, 30); + gchar *short_name = document_get_basename_for_display(doc, interface_prefs.tab_label_len); gchar *dirname = g_path_get_dirname(DOC_FILENAME(doc));
g_string_append(str, short_name); @@ -2369,6 +2369,8 @@ void ui_init_prefs(void) "msgwin_scribble_visible", TRUE); stash_group_add_boolean(group, &interface_prefs.warn_on_project_close, "warn_on_project_close", TRUE); + stash_group_add_spin_button_integer(group, &interface_prefs.tab_label_len, + "tab_label_length", 99999, "spin_tab_label_len"); }
Modified: src/ui_utils.h 2 lines changed, 2 insertions(+), 0 deletions(-) =================================================================== @@ -72,6 +72,8 @@ typedef struct GeanyInterfacePrefs /** whether to show a warning when closing a project to open a new one */ gboolean warn_on_project_close; gint openfiles_path_mode; + /** number of characters of a filename to be visible on the tab label */ + gint tab_label_len; } GeanyInterfacePrefs;
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).