-
Notifications
You must be signed in to change notification settings - Fork 274
commander: small improvement on listing and panel width #1394
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -345,7 +345,16 @@ store_populate_menu_items (GtkListStore *store, | |
} else { | ||
gchar *tmp; | ||
gchar *tooltip; | ||
gchar *label = g_markup_printf_escaped ("<big>%s</big>", item_label); | ||
gchar *basename = g_path_get_basename (item_label); | ||
gchar *dirname = g_path_get_dirname (item_label); | ||
gchar *dirname_basename = g_path_get_basename(dirname); | ||
gchar *label; | ||
|
||
if (g_strcmp0(".", dirname_basename) == 0) { | ||
label = g_markup_printf_escaped ("<big>%s</big>", basename); | ||
} else { | ||
label = g_markup_printf_escaped ("<big>%s/%s</big>", dirname_basename, basename); | ||
} | ||
|
||
tooltip = gtk_widget_get_tooltip_markup (node->data); | ||
if (tooltip) { | ||
|
@@ -365,6 +374,9 @@ store_populate_menu_items (GtkListStore *store, | |
-1); | ||
|
||
g_free (label); | ||
g_free (basename); | ||
g_free (dirname); | ||
g_free (dirname_basename); | ||
} | ||
|
||
g_free (item_label); | ||
|
@@ -410,8 +422,11 @@ fill_store (GtkListStore *store) | |
/* open files */ | ||
foreach_document (i) { | ||
gchar *basename = g_path_get_basename (DOC_FILENAME (documents[i])); | ||
gchar *label = g_markup_printf_escaped ("<big>%s</big>\n" | ||
gchar *dirname = g_path_get_dirname (DOC_FILENAME (documents[i])); | ||
gchar *dirname_basename = g_path_get_basename (dirname); | ||
gchar *label = g_markup_printf_escaped ("<big>%s/%s</big>\n" | ||
"<small><i>%s</i></small>", | ||
dirname_basename, | ||
Comment on lines
+425
to
+429
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here it's not as problematic as those are paths. However, the dirname is not necessarily helping much as it might very well still be the same (e.g. if there are If this is really an issue you encounter, I suggest investigating a more clever solution, possibly verifying there are effectively duplicates, and then compute the difference between the paths in order to show parts that are actually relevant. IIRC there's something like that in Geany's got to popup you might get inspiration from. Once that's dealt with I wonder what the best visual layout would be… maybe There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree that your suggestion would be better and would address all cases well. I was actually thinking if I could do some computing for all items before getting the best display option. However, I think that would require more resources, and I don't think it's I will spend a little more time on this, at least for my own usage. If you think there should be more efficient way to address the problem, I can help to open an issue and hopefully someone from the community can help. Thank you a lot for your time. |
||
basename, | ||
DOC_FILENAME (documents[i])); | ||
|
||
|
@@ -422,6 +437,8 @@ fill_store (GtkListStore *store) | |
COL_DOCUMENT, documents[i], | ||
-1); | ||
g_free (basename); | ||
g_free (dirname); | ||
g_free (dirname_basename); | ||
g_free (label); | ||
} | ||
} | ||
|
@@ -658,10 +675,17 @@ create_panel (void) | |
GtkWidget *scroll; | ||
GtkTreeViewColumn *col; | ||
GtkCellRenderer *cell; | ||
|
||
int window_width; | ||
int window_height; | ||
|
||
gtk_window_get_size (GTK_WINDOW(geany_data->main_widgets->window), &window_width, &window_height); | ||
if (window_width >= 500) { | ||
window_width = window_width / 2; | ||
} | ||
Comment on lines
+682
to
+684
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is 500 really too big? Otherwise if the goal is to make it bigger, then the threshold should be whatever makes it larger than 500 (math suggests it'd be 1000). Also note that this is not dynamic during a Geany session, it's only the default size when opening the panel for the first time, if you change the Geany window size later it won't affect this. This is not necessarily an issue though. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When the main window has some moderate size , I want(ed) the commander's panel has relatively smaller size. When the main window is too small (< 500), I want to see the commander of the same size (otherwise it's too small to show any thing if I get it right.) I admit my calculation is bad. It's better that I used some min() function instead.
I've also noticed that, thanks for your confirmation. |
||
|
||
plugin_data.panel = g_object_new (GTK_TYPE_WINDOW, | ||
"decorated", FALSE, | ||
"default-width", 500, | ||
"default-width", window_width, | ||
"default-height", 200, | ||
"transient-for", geany_data->main_widgets->window, | ||
"window-position", GTK_WIN_POS_CENTER_ON_PARENT, | ||
|
@@ -804,4 +828,4 @@ void | |
plugin_help (void) | ||
{ | ||
utils_open_browser (DOCDIR "/" PLUGIN "/README"); | ||
} | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please bring the trailing newline back 🙂 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure I will do that. This would be a bug somewhere in (my) Geany system. OT: I was into this issue #1394 (comment), now I have two options at project level ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems overly fragile to me, as menu item labels can contain pretty much anything, including
/
s.Take for example Edit → Insert Date → yyyy/mm/dd: with this change, it appears as mm/dd.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that may be a problem, and in that case, it's also possible to see all details in the smaller part of the menu item (
Edit → Insert Date → yyyy/mm/dd
).