Use enum values to reference different treeview widgets (code cleanup).

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@904 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Enrico Tröger 2006-10-18 20:48:54 +00:00
parent 10c0780d4d
commit 59335b597f
6 changed files with 27 additions and 21 deletions

View File

@ -3,6 +3,9 @@
* src/utils.c, src/treeviews.c, tagmanager/c.c:
Use "::" as context separator only for C++, otherwise use ".".
Detect module declarations in D and put them in the symbol list.
* src/callbacks.c, src/geany.h, src/msgwindow.c, src/treeviews.c:
Use enum values to reference different treeview widgets
(code cleanup).
2006-10-18 Nick Treleaven <nick.treleaven@btinternet.com>

View File

@ -1404,17 +1404,17 @@ on_tree_view_button_press_event (GtkWidget *widget,
{
if (event->type == GDK_2BUTTON_PRESS && user_data)
{
if (GPOINTER_TO_INT(user_data) == 4)
if (GPOINTER_TO_INT(user_data) == MSG_MESSAGE)
{ // double click in the message treeview (results of 'Find usage')
msgwin_goto_messages_file_line();
}
else if (GPOINTER_TO_INT(user_data) == 5)
else if (GPOINTER_TO_INT(user_data) == MSG_COMPILER)
{ // double click in the compiler treeview
msgwin_goto_compiler_file_line();
}
}
if (event->button == 1 && user_data && GPOINTER_TO_INT(user_data) == 7)
if (event->button == 1 && user_data && GPOINTER_TO_INT(user_data) == TREEVIEW_SYMBOL)
{ // allow reclicking of taglist treeview item
GtkTreeSelection *select =
gtk_tree_view_get_selection(GTK_TREE_VIEW(widget));
@ -1423,15 +1423,15 @@ on_tree_view_button_press_event (GtkWidget *widget,
if (user_data && event->button == 3)
{ // popupmenu to hide or clear the active treeview
if (user_data && GPOINTER_TO_INT(user_data) == 3)
if (GPOINTER_TO_INT(user_data) == MSG_STATUS)
gtk_menu_popup(GTK_MENU(msgwindow.popup_status_menu), NULL, NULL, NULL, NULL, event->button, event->time);
else if (user_data && GPOINTER_TO_INT(user_data) == 4)
else if (GPOINTER_TO_INT(user_data) == MSG_MESSAGE)
gtk_menu_popup(GTK_MENU(msgwindow.popup_msg_menu), NULL, NULL, NULL, NULL, event->button, event->time);
else if (user_data && GPOINTER_TO_INT(user_data) == 5)
else if (GPOINTER_TO_INT(user_data) == MSG_COMPILER)
gtk_menu_popup(GTK_MENU(msgwindow.popup_compiler_menu), NULL, NULL, NULL, NULL, event->button, event->time);
else if (user_data && GPOINTER_TO_INT(user_data) == 6)
else if (GPOINTER_TO_INT(user_data) == TREEVIEW_OPENFILES)
gtk_menu_popup(GTK_MENU(tv.popup_openfiles), NULL, NULL, NULL, NULL, event->button, event->time);
else if (user_data && GPOINTER_TO_INT(user_data) == 7)
else if (GPOINTER_TO_INT(user_data) == TREEVIEW_SYMBOL)
gtk_menu_popup(GTK_MENU(tv.popup_taglist), NULL, NULL, NULL, NULL, event->button, event->time);
}
return FALSE;

View File

@ -210,5 +210,16 @@ enum {
GIGABYTE = (MEGABYTE*1024)
};
enum
{
MSG_STATUS = 1,
MSG_COMPILER,
MSG_MESSAGE,
MSG_SCRATCH,
MSG_VTE,
TREEVIEW_SYMBOL,
TREEVIEW_OPENFILES
};
#endif

View File

@ -90,7 +90,7 @@ void msgwin_prepare_status_tree_view(void)
gtk_widget_modify_font(msgwindow.tree_status, pango_font_description_from_string(app->msgwin_font));
g_signal_connect(G_OBJECT(msgwindow.tree_status), "button-press-event",
G_CALLBACK(on_tree_view_button_press_event), GINT_TO_POINTER(3));
G_CALLBACK(on_tree_view_button_press_event), GINT_TO_POINTER(MSG_STATUS));
}
@ -114,7 +114,7 @@ void msgwin_prepare_msg_tree_view(void)
gtk_widget_modify_font(msgwindow.tree_msg, pango_font_description_from_string(app->msgwin_font));
g_signal_connect(G_OBJECT(msgwindow.tree_msg), "button-press-event",
G_CALLBACK(on_tree_view_button_press_event), GINT_TO_POINTER(4));
G_CALLBACK(on_tree_view_button_press_event), GINT_TO_POINTER(MSG_MESSAGE));
// selection handling
select = gtk_tree_view_get_selection(GTK_TREE_VIEW(msgwindow.tree_msg));
@ -141,7 +141,7 @@ void msgwin_prepare_compiler_tree_view(void)
gtk_widget_modify_font(msgwindow.tree_compiler, pango_font_description_from_string(app->msgwin_font));
g_signal_connect(G_OBJECT(msgwindow.tree_compiler), "button-press-event",
G_CALLBACK(on_tree_view_button_press_event), GINT_TO_POINTER(5));
G_CALLBACK(on_tree_view_button_press_event), GINT_TO_POINTER(MSG_COMPILER));
// selection handling
select = gtk_tree_view_get_selection(GTK_TREE_VIEW(msgwindow.tree_compiler));

View File

@ -33,14 +33,6 @@ enum
COLOR_BLUE
};
enum
{
MSG_STATUS = 0,
MSG_COMPILER,
MSG_MESSAGE,
MSG_SCRATCH,
MSG_VTE
};
typedef struct

View File

@ -44,7 +44,7 @@ void treeviews_prepare_taglist(GtkWidget *tree, GtkTreeStore *store)
gtk_widget_modify_font(tree, pango_font_description_from_string(app->tagbar_font));
gtk_tree_view_set_model(GTK_TREE_VIEW(tree), GTK_TREE_MODEL(store));
g_signal_connect(G_OBJECT(tree), "button-press-event",
G_CALLBACK(on_tree_view_button_press_event), GINT_TO_POINTER(7));
G_CALLBACK(on_tree_view_button_press_event), GINT_TO_POINTER(TREEVIEW_SYMBOL));
gtk_tree_view_set_enable_search(GTK_TREE_VIEW(tree), FALSE);
@ -254,7 +254,7 @@ void treeviews_prepare_openfiles(void)
gtk_widget_modify_font(tv.tree_openfiles, pango_font_description_from_string(app->tagbar_font));
g_signal_connect(G_OBJECT(tv.tree_openfiles), "button-press-event",
G_CALLBACK(on_tree_view_button_press_event), GINT_TO_POINTER(6));
G_CALLBACK(on_tree_view_button_press_event), GINT_TO_POINTER(TREEVIEW_OPENFILES));
// selection handling
select = gtk_tree_view_get_selection(GTK_TREE_VIEW(tv.tree_openfiles));