Add menu accelerators to the symbol and open files list popup menus.
Add option to display full path name in the open files list. git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@1941 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
parent
df4c6bebc8
commit
1d9c244ad1
@ -1,3 +1,11 @@
|
||||
2007-10-13 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
|
||||
|
||||
* geany.glade, src/interface.c, src/keyfile.c, src/plugindata.h,
|
||||
src/prefs.c, src/prefs.h, src/treeviews.c, src/treeviews.h:
|
||||
Add menu accelerators to the symbol and open files list popup menus.
|
||||
Add option to display full path name in the open files list.
|
||||
|
||||
|
||||
2007-10-10 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
|
||||
|
||||
* NEWS, doc/geany.1.in: Update for 0.12.
|
||||
|
||||
19
geany.glade
19
geany.glade
@ -3665,6 +3665,25 @@
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="check_list_openfiles_fullpath">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Show full path name in open files list</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">False</property>
|
||||
<property name="active">False</property>
|
||||
<property name="inconsistent">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
@ -2416,6 +2416,7 @@ create_prefs_dialog (void)
|
||||
GtkWidget *vbox11;
|
||||
GtkWidget *check_list_symbol;
|
||||
GtkWidget *check_list_openfiles;
|
||||
GtkWidget *check_list_openfiles_fullpath;
|
||||
GtkWidget *label146;
|
||||
GtkWidget *frame4;
|
||||
GtkWidget *alignment5;
|
||||
@ -2872,6 +2873,11 @@ create_prefs_dialog (void)
|
||||
gtk_tooltips_set_tip (tooltips, check_list_openfiles, _("Toggle the open files list on and off"), NULL);
|
||||
gtk_button_set_focus_on_click (GTK_BUTTON (check_list_openfiles), FALSE);
|
||||
|
||||
check_list_openfiles_fullpath = gtk_check_button_new_with_mnemonic (_("Show full path name in open files list"));
|
||||
gtk_widget_show (check_list_openfiles_fullpath);
|
||||
gtk_box_pack_start (GTK_BOX (vbox11), check_list_openfiles_fullpath, FALSE, FALSE, 0);
|
||||
gtk_button_set_focus_on_click (GTK_BUTTON (check_list_openfiles_fullpath), FALSE);
|
||||
|
||||
label146 = gtk_label_new (_("<b>Sidebar</b>"));
|
||||
gtk_widget_show (label146);
|
||||
gtk_frame_set_label_widget (GTK_FRAME (frame7), label146);
|
||||
@ -4191,6 +4197,7 @@ create_prefs_dialog (void)
|
||||
GLADE_HOOKUP_OBJECT (prefs_dialog, vbox11, "vbox11");
|
||||
GLADE_HOOKUP_OBJECT (prefs_dialog, check_list_symbol, "check_list_symbol");
|
||||
GLADE_HOOKUP_OBJECT (prefs_dialog, check_list_openfiles, "check_list_openfiles");
|
||||
GLADE_HOOKUP_OBJECT (prefs_dialog, check_list_openfiles_fullpath, "check_list_openfiles_fullpath");
|
||||
GLADE_HOOKUP_OBJECT (prefs_dialog, label146, "label146");
|
||||
GLADE_HOOKUP_OBJECT (prefs_dialog, frame4, "frame4");
|
||||
GLADE_HOOKUP_OBJECT (prefs_dialog, alignment5, "alignment5");
|
||||
|
||||
@ -159,6 +159,7 @@ static void save_dialog_prefs(GKeyFile *config)
|
||||
// interface
|
||||
g_key_file_set_boolean(config, PACKAGE, "sidebar_symbol_visible", prefs.sidebar_symbol_visible);
|
||||
g_key_file_set_boolean(config, PACKAGE, "sidebar_openfiles_visible", prefs.sidebar_openfiles_visible);
|
||||
g_key_file_set_boolean(config, PACKAGE, "sidebar_openfiles_fullpath", prefs.sidebar_openfiles_fullpath);
|
||||
g_key_file_set_string(config, PACKAGE, "editor_font", prefs.editor_font);
|
||||
g_key_file_set_string(config, PACKAGE, "tagbar_font", prefs.tagbar_font);
|
||||
g_key_file_set_string(config, PACKAGE, "msgwin_font", prefs.msgwin_font);
|
||||
@ -432,6 +433,7 @@ static void load_dialog_prefs(GKeyFile *config)
|
||||
prefs.tab_pos_sidebar = utils_get_setting_integer(config, PACKAGE, "tab_pos_sidebar", GTK_POS_TOP);
|
||||
prefs.sidebar_symbol_visible = utils_get_setting_boolean(config, PACKAGE, "sidebar_symbol_visible", TRUE);
|
||||
prefs.sidebar_openfiles_visible = utils_get_setting_boolean(config, PACKAGE, "sidebar_openfiles_visible", TRUE);
|
||||
prefs.sidebar_openfiles_fullpath = utils_get_setting_boolean(config, PACKAGE, "sidebar_openfiles_fullpath", FALSE);
|
||||
prefs.statusbar_visible = utils_get_setting_boolean(config, PACKAGE, "statusbar_visible", TRUE);
|
||||
prefs.tab_order_ltr = utils_get_setting_boolean(config, PACKAGE, "tab_order_ltr", TRUE);
|
||||
prefs.show_notebook_tabs = utils_get_setting_boolean(config, PACKAGE, "show_notebook_tabs", TRUE);
|
||||
|
||||
@ -71,12 +71,12 @@
|
||||
|
||||
/* The API version should be incremented whenever any plugin data types below are
|
||||
* modified. */
|
||||
static const gint api_version = 20;
|
||||
static const gint api_version = 21;
|
||||
|
||||
/* The ABI version should be incremented whenever existing fields in the plugin
|
||||
* data types below have to be changed or reordered. It should stay the same if fields
|
||||
* are only appended, as this doesn't affect existing fields. */
|
||||
static const gint abi_version = 10;
|
||||
static const gint abi_version = 11;
|
||||
|
||||
/* This performs runtime checks that try to ensure:
|
||||
* 1. Geany ABI data types are compatible with this plugin.
|
||||
|
||||
19
src/prefs.c
19
src/prefs.c
@ -77,6 +77,7 @@ static void on_show_notebook_tabs_toggled(GtkToggleButton *togglebutton, gpointe
|
||||
static void on_use_folding_toggled(GtkToggleButton *togglebutton, gpointer user_data);
|
||||
static void on_symbol_auto_completion_toggled(GtkToggleButton *togglebutton, gpointer user_data);
|
||||
static void on_open_encoding_toggled(GtkToggleButton *togglebutton, gpointer user_data);
|
||||
static void on_openfiles_visible_toggled(GtkToggleButton *togglebutton, gpointer user_data);
|
||||
|
||||
|
||||
void prefs_init_dialog(void)
|
||||
@ -132,6 +133,10 @@ void prefs_init_dialog(void)
|
||||
|
||||
widget = lookup_widget(ui_widgets.prefs_dialog, "check_list_openfiles");
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), prefs.sidebar_openfiles_visible);
|
||||
on_openfiles_visible_toggled(GTK_TOGGLE_BUTTON(widget), NULL);
|
||||
|
||||
widget = lookup_widget(ui_widgets.prefs_dialog, "check_list_openfiles_fullpath");
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), prefs.sidebar_openfiles_fullpath);
|
||||
|
||||
widget = lookup_widget(ui_widgets.prefs_dialog, "tagbar_font");
|
||||
gtk_font_button_set_font_name(GTK_FONT_BUTTON(widget), prefs.tagbar_font);
|
||||
@ -531,6 +536,9 @@ on_prefs_button_clicked(GtkDialog *dialog, gint response, gpointer user_data)
|
||||
widget = lookup_widget(ui_widgets.prefs_dialog, "check_list_openfiles");
|
||||
prefs.sidebar_openfiles_visible = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
||||
|
||||
widget = lookup_widget(ui_widgets.prefs_dialog, "check_list_openfiles_fullpath");
|
||||
prefs.sidebar_openfiles_fullpath = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
||||
|
||||
widget = lookup_widget(ui_widgets.prefs_dialog, "radio_long_line_line");
|
||||
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) editor_prefs.long_line_type = 0;
|
||||
else
|
||||
@ -780,6 +788,7 @@ on_prefs_button_clicked(GtkDialog *dialog, gint response, gpointer user_data)
|
||||
|
||||
// apply the changes made
|
||||
ui_statusbar_showhide(prefs.statusbar_visible);
|
||||
treeviews_openfiles_update_all(); // to update if full path setting has changed
|
||||
ui_update_toolbar_items();
|
||||
ui_update_toolbar_icons(prefs.toolbar_icon_size);
|
||||
gtk_toolbar_set_style(GTK_TOOLBAR(app->toolbar), prefs.toolbar_icon_style);
|
||||
@ -1118,6 +1127,14 @@ static void on_open_encoding_toggled(GtkToggleButton *togglebutton, gpointer use
|
||||
}
|
||||
|
||||
|
||||
static void on_openfiles_visible_toggled(GtkToggleButton *togglebutton, gpointer user_data)
|
||||
{
|
||||
gboolean sens = gtk_toggle_button_get_active(togglebutton);
|
||||
|
||||
gtk_widget_set_sensitive(lookup_widget(ui_widgets.prefs_dialog, "check_list_openfiles_fullpath"), sens);
|
||||
}
|
||||
|
||||
|
||||
void prefs_show_dialog(void)
|
||||
{
|
||||
if (ui_widgets.prefs_dialog == NULL)
|
||||
@ -1189,6 +1206,8 @@ void prefs_show_dialog(void)
|
||||
"toggled", G_CALLBACK(on_symbol_auto_completion_toggled), NULL);
|
||||
g_signal_connect((gpointer) lookup_widget(ui_widgets.prefs_dialog, "check_open_encoding"),
|
||||
"toggled", G_CALLBACK(on_open_encoding_toggled), NULL);
|
||||
g_signal_connect((gpointer) lookup_widget(ui_widgets.prefs_dialog, "check_list_openfiles"),
|
||||
"toggled", G_CALLBACK(on_openfiles_visible_toggled), NULL);
|
||||
}
|
||||
|
||||
prefs_init_dialog();
|
||||
|
||||
@ -44,6 +44,7 @@ typedef struct GeanyPrefs
|
||||
/* interface */
|
||||
gboolean sidebar_symbol_visible;
|
||||
gboolean sidebar_openfiles_visible;
|
||||
gboolean sidebar_openfiles_fullpath;
|
||||
gchar *editor_font;
|
||||
gchar *tagbar_font;
|
||||
gchar *msgwin_font;
|
||||
|
||||
@ -53,6 +53,7 @@ enum
|
||||
OPENFILES_ACTION_REMOVE = 0,
|
||||
OPENFILES_ACTION_SAVE,
|
||||
OPENFILES_ACTION_RELOAD,
|
||||
OPENFILES_ACTION_FULLPATH,
|
||||
OPENFILES_ACTION_HIDE,
|
||||
OPENFILES_ACTION_HIDE_ALL,
|
||||
SYMBOL_ACTION_SORT_BY_NAME,
|
||||
@ -65,7 +66,6 @@ enum
|
||||
static GtkListStore *store_openfiles;
|
||||
static GtkWidget *tag_window; // scrolled window that holds the symbol list GtkTreeView
|
||||
|
||||
|
||||
/* callback prototypes */
|
||||
static void on_taglist_tree_popup_clicked(GtkMenuItem *menuitem, gpointer user_data);
|
||||
static void on_openfiles_tree_selection_changed(GtkTreeSelection *selection, gpointer data);
|
||||
@ -289,18 +289,21 @@ void treeviews_openfiles_update(gint idx)
|
||||
gchar *basename;
|
||||
GdkColor *color = document_get_status(idx);
|
||||
|
||||
basename = g_path_get_basename(DOC_FILENAME(idx));
|
||||
if (prefs.sidebar_openfiles_fullpath)
|
||||
basename = DOC_FILENAME(idx);
|
||||
else
|
||||
basename = g_path_get_basename(DOC_FILENAME(idx));
|
||||
gtk_list_store_set(store_openfiles, &doc_list[idx].iter,
|
||||
#if GTK_CHECK_VERSION(2, 12, 0)
|
||||
0, basename, 1, idx, 2, color, 3, DOC_FILENAME(idx), -1);
|
||||
#else
|
||||
0, basename, 1, idx, 2, color, -1);
|
||||
#endif
|
||||
g_free(basename);
|
||||
if (! prefs.sidebar_openfiles_fullpath)
|
||||
g_free(basename);
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
void treeviews_openfiles_update_all()
|
||||
{
|
||||
guint i;
|
||||
@ -315,7 +318,6 @@ void treeviews_openfiles_update_all()
|
||||
treeviews_openfiles_add(idx);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void treeviews_remove_document(gint idx)
|
||||
@ -343,14 +345,14 @@ static void create_taglist_popup_menu()
|
||||
|
||||
tv.popup_taglist = gtk_menu_new();
|
||||
|
||||
item = gtk_menu_item_new_with_label(_("Sort by name"));
|
||||
item = gtk_menu_item_new_with_mnemonic(_("Sort by _name"));
|
||||
gtk_widget_show(item);
|
||||
gtk_container_add(GTK_CONTAINER(tv.popup_taglist), item);
|
||||
g_signal_connect((gpointer) item, "activate",
|
||||
G_CALLBACK(on_taglist_tree_popup_clicked),
|
||||
GINT_TO_POINTER(SYMBOL_ACTION_SORT_BY_NAME));
|
||||
|
||||
item = gtk_menu_item_new_with_label(_("Sort by appearance"));
|
||||
item = gtk_menu_item_new_with_mnemonic(_("Sort by _appearance"));
|
||||
gtk_widget_show(item);
|
||||
gtk_container_add(GTK_CONTAINER(tv.popup_taglist), item);
|
||||
g_signal_connect((gpointer) item, "activate",
|
||||
@ -361,7 +363,7 @@ static void create_taglist_popup_menu()
|
||||
gtk_widget_show(item);
|
||||
gtk_container_add(GTK_CONTAINER(tv.popup_taglist), item);
|
||||
|
||||
item = gtk_image_menu_item_new_with_label(_("Hide"));
|
||||
item = gtk_image_menu_item_new_with_mnemonic(_("_Hide"));
|
||||
gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item),
|
||||
gtk_image_new_from_stock("gtk-close", GTK_ICON_SIZE_MENU));
|
||||
gtk_widget_show(item);
|
||||
@ -369,7 +371,7 @@ static void create_taglist_popup_menu()
|
||||
g_signal_connect((gpointer) item, "activate",
|
||||
G_CALLBACK(on_taglist_tree_popup_clicked), GINT_TO_POINTER(SYMBOL_ACTION_HIDE));
|
||||
|
||||
item = gtk_image_menu_item_new_with_label(_("Hide sidebar"));
|
||||
item = gtk_image_menu_item_new_with_mnemonic(_("H_ide sidebar"));
|
||||
gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item),
|
||||
gtk_image_new_from_stock("gtk-close", GTK_ICON_SIZE_MENU));
|
||||
gtk_widget_show(item);
|
||||
@ -389,7 +391,7 @@ static void create_openfiles_popup_menu()
|
||||
gtk_widget_show(item);
|
||||
gtk_container_add(GTK_CONTAINER(tv.popup_openfiles), item);
|
||||
g_signal_connect((gpointer) item, "activate",
|
||||
G_CALLBACK(on_openfiles_tree_popup_clicked), GINT_TO_POINTER(OPENFILES_ACTION_REMOVE));
|
||||
G_CALLBACK(on_openfiles_tree_popup_clicked), GINT_TO_POINTER(OPENFILES_ACTION_REMOVE));
|
||||
|
||||
item = gtk_separator_menu_item_new();
|
||||
gtk_widget_show(item);
|
||||
@ -399,21 +401,27 @@ static void create_openfiles_popup_menu()
|
||||
gtk_widget_show(item);
|
||||
gtk_container_add(GTK_CONTAINER(tv.popup_openfiles), item);
|
||||
g_signal_connect((gpointer) item, "activate",
|
||||
G_CALLBACK(on_openfiles_tree_popup_clicked), GINT_TO_POINTER(OPENFILES_ACTION_SAVE));
|
||||
G_CALLBACK(on_openfiles_tree_popup_clicked), GINT_TO_POINTER(OPENFILES_ACTION_SAVE));
|
||||
|
||||
item = gtk_image_menu_item_new_with_label(_("Reload"));
|
||||
item = gtk_image_menu_item_new_with_mnemonic(_("_Reload"));
|
||||
gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item),
|
||||
gtk_image_new_from_stock("gtk-revert-to-saved", GTK_ICON_SIZE_MENU));
|
||||
gtk_widget_show(item);
|
||||
gtk_container_add(GTK_CONTAINER(tv.popup_openfiles), item);
|
||||
g_signal_connect((gpointer) item, "activate",
|
||||
G_CALLBACK(on_openfiles_tree_popup_clicked), GINT_TO_POINTER(OPENFILES_ACTION_RELOAD));
|
||||
G_CALLBACK(on_openfiles_tree_popup_clicked), GINT_TO_POINTER(OPENFILES_ACTION_RELOAD));
|
||||
|
||||
item = gtk_separator_menu_item_new();
|
||||
gtk_widget_show(item);
|
||||
gtk_container_add(GTK_CONTAINER(tv.popup_openfiles), item);
|
||||
|
||||
item = gtk_image_menu_item_new_with_label(_("Hide"));
|
||||
tv.popup_openfiles_fullpath = gtk_check_menu_item_new_with_mnemonic(_("Show _full path name"));
|
||||
gtk_widget_show(tv.popup_openfiles_fullpath);
|
||||
gtk_container_add(GTK_CONTAINER(tv.popup_openfiles), tv.popup_openfiles_fullpath);
|
||||
g_signal_connect((gpointer) tv.popup_openfiles_fullpath, "activate",
|
||||
G_CALLBACK(on_openfiles_tree_popup_clicked), GINT_TO_POINTER(OPENFILES_ACTION_FULLPATH));
|
||||
|
||||
item = gtk_image_menu_item_new_with_mnemonic(_("_Hide"));
|
||||
gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item),
|
||||
gtk_image_new_from_stock("gtk-close", GTK_ICON_SIZE_MENU));
|
||||
gtk_widget_show(item);
|
||||
@ -421,7 +429,7 @@ static void create_openfiles_popup_menu()
|
||||
g_signal_connect((gpointer) item, "activate", G_CALLBACK(on_openfiles_tree_popup_clicked),
|
||||
GINT_TO_POINTER(OPENFILES_ACTION_HIDE));
|
||||
|
||||
item = gtk_image_menu_item_new_with_label(_("Hide sidebar"));
|
||||
item = gtk_image_menu_item_new_with_mnemonic(_("H_ide sidebar"));
|
||||
gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item),
|
||||
gtk_image_new_from_stock("gtk-close", GTK_ICON_SIZE_MENU));
|
||||
gtk_widget_show(item);
|
||||
@ -488,6 +496,15 @@ static void on_openfiles_tree_popup_clicked(GtkMenuItem *menuitem, gpointer user
|
||||
on_toolbutton23_clicked(NULL, NULL);
|
||||
break;
|
||||
}
|
||||
case OPENFILES_ACTION_FULLPATH:
|
||||
{
|
||||
if (! app->ignore_callback)
|
||||
{
|
||||
prefs.sidebar_openfiles_fullpath = ! prefs.sidebar_openfiles_fullpath;
|
||||
treeviews_openfiles_update_all();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case OPENFILES_ACTION_HIDE:
|
||||
{
|
||||
prefs.sidebar_openfiles_visible = FALSE;
|
||||
@ -609,8 +626,14 @@ static gboolean on_treeviews_button_press_event(GtkWidget *widget, GdkEventButto
|
||||
if (event->button == 3)
|
||||
{ // popupmenu to hide or clear the active treeview
|
||||
if (GPOINTER_TO_INT(user_data) == TREEVIEW_OPENFILES)
|
||||
{
|
||||
app->ignore_callback = TRUE;
|
||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(tv.popup_openfiles_fullpath),
|
||||
prefs.sidebar_openfiles_fullpath);
|
||||
app->ignore_callback = FALSE;
|
||||
gtk_menu_popup(GTK_MENU(tv.popup_openfiles), NULL, NULL, NULL, NULL,
|
||||
event->button, event->time);
|
||||
}
|
||||
else if (GPOINTER_TO_INT(user_data) == TREEVIEW_SYMBOL)
|
||||
{
|
||||
gtk_menu_popup(GTK_MENU(tv.popup_taglist), NULL, NULL, NULL, NULL,
|
||||
|
||||
@ -33,6 +33,7 @@ typedef struct SidebarTreeviews
|
||||
GtkWidget *default_tag_tree;
|
||||
GtkWidget *popup_taglist;
|
||||
GtkWidget *popup_openfiles;
|
||||
GtkWidget *popup_openfiles_fullpath;
|
||||
} SidebarTreeviews;
|
||||
|
||||
extern SidebarTreeviews tv;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user