diff options
author | Ronnie Sahlberg <ronnie_sahlberg@ozemail.com.au> | 2007-12-08 22:45:30 +0000 |
---|---|---|
committer | Ronnie Sahlberg <ronnie_sahlberg@ozemail.com.au> | 2007-12-08 22:45:30 +0000 |
commit | b57ce9e48f40bd5c4fc3cd2e58d9cd9d5246465f (patch) | |
tree | 585ec1176c91c7a94558a4d1aa737c45de0be17c /gtk/proto_hier_stats_dlg.c | |
parent | 01ec87aee521f531f862e5fe98de61c069e26713 (diff) |
some updates to make it compile with gtk/glib < 2
svn path=/trunk/; revision=23810
Diffstat (limited to 'gtk/proto_hier_stats_dlg.c')
-rw-r--r-- | gtk/proto_hier_stats_dlg.c | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/gtk/proto_hier_stats_dlg.c b/gtk/proto_hier_stats_dlg.c index f60f95d7bc..0f631cd596 100644 --- a/gtk/proto_hier_stats_dlg.c +++ b/gtk/proto_hier_stats_dlg.c @@ -73,7 +73,6 @@ typedef struct { ph_stats_t *ps; } draw_info_t; -static GtkWidget *popup_menu_object; static GtkWidget *tree; #define PCT(x,y) (100.0 * (float)(x) / (float)(y)) @@ -97,6 +96,8 @@ static GtkWidget *tree; 4: And Not Selected 5: Or Not Selected */ + +#if GTK_MAJOR_VERSION >= 2 static void proto_hier_select_filter_cb(GtkWidget *widget _U_, gpointer callback_data _U_, guint callback_action) { @@ -105,20 +106,16 @@ proto_hier_select_filter_cb(GtkWidget *widget _U_, gpointer callback_data _U_, g char str[256]; const char *current_filter; const char *filter = NULL; -#if GTK_MAJOR_VERSION >= 2 GtkTreeSelection *sel; GtkTreeModel *model; GtkTreeIter iter; -#endif action = (callback_action>>8)&0xff; type = callback_action&0xff; -#if GTK_MAJOR_VERSION >= 2 sel = gtk_tree_view_get_selection (GTK_TREE_VIEW(tree)); gtk_tree_selection_get_selected (sel, &model, &iter); gtk_tree_model_get (model, &iter, FILTER_NAME, &filter, -1); -#endif if (filter && 0 != strlen(filter)) { g_snprintf(dirstr, 127, "%s", filter); } else { @@ -195,19 +192,6 @@ proto_hier_select_filter_cb(GtkWidget *widget _U_, gpointer callback_data _U_, g break; } } -static gint -proto_hier_show_popup_menu_cb(GtkWidget *widget _U_, GdkEvent *event, gpointer data _U_) -{ - GdkEventButton *bevent = (GdkEventButton *)event; - - if(event->type==GDK_BUTTON_PRESS && bevent->button==3){ - /* If this is a right click on one of our columns, popup the context menu */ - gtk_menu_popup(GTK_MENU(popup_menu_object), NULL, NULL, NULL, NULL, - bevent->button, bevent->time); - } - - return FALSE; -} static GtkItemFactoryEntry proto_hier_list_menu_items[] = { @@ -256,6 +240,7 @@ static GtkItemFactoryEntry proto_hier_list_menu_items[] = proto_hier_select_filter_cb, 5*256+0, NULL, NULL), }; +#endif static void fill_in_tree_node(GNode *node, gpointer data) @@ -366,6 +351,23 @@ fill_in_tree(GtkWidget *tree, ph_stats_t *ps) fill_in_tree_node, &di); } +#if GTK_MAJOR_VERSION >= 2 +static GtkWidget *popup_menu_object; + +static gint +proto_hier_show_popup_menu_cb(GtkWidget *widget _U_, GdkEvent *event, gpointer data _U_) +{ + GdkEventButton *bevent = (GdkEventButton *)event; + + if(event->type==GDK_BUTTON_PRESS && bevent->button==3){ + /* If this is a right click on one of our columns, popup the context menu */ + gtk_menu_popup(GTK_MENU(popup_menu_object), NULL, NULL, NULL, NULL, + bevent->button, bevent->time); + } + + return FALSE; +} + static void proto_hier_create_popup_menu(void) { @@ -376,6 +378,7 @@ proto_hier_create_popup_menu(void) popup_menu_object = gtk_item_factory_get_widget (item_factory, "<main>"); SIGNAL_CONNECT(tree, "button_press_event", proto_hier_show_popup_menu_cb, NULL); } +#endif #define MAX_DLG_HEIGHT 450 #define DEF_DLG_WIDTH 700 |