diff --git a/commander/src/commander-plugin.c b/commander/src/commander-plugin.c index 62b0fb7ca..39989da9b 100644 --- a/commander/src/commander-plugin.c +++ b/commander/src/commander-plugin.c @@ -345,7 +345,16 @@ store_populate_menu_items (GtkListStore *store, } else { gchar *tmp; gchar *tooltip; - gchar *label = g_markup_printf_escaped ("%s", 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 ("%s", basename); + } else { + label = g_markup_printf_escaped ("%s/%s", 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 ("%s\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 ("%s/%s\n" "%s", + dirname_basename, 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; + } + 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"); -} +} \ No newline at end of file