GTK+ 3 vs GKrellM public API
Jindřich Makovička <[email protected]> Thu, 28 Oct 2010 21:48:31 +0200
| Newsgroups | gmane.comp.gnome.apps.gkrellm |
|---|---|
| Message-ID | <[email protected]> |
Hi, trying to build my plugin with -DGTK_DISABLE_DEPRECATED -DGSEAL_ENABLE , I just noticed that GKrellM public API still contains references to GtkItemFactory and GtkTooltips, which are scheduled for removal in GTK3. Considering that GTK3 release is planned at the end of the year, I'd like to ask if there are any plans on an API transition? As far as I looked into the code, auto_resolution_item_factory in GkrellmChartconfig should not be much used by outside code, and tooltip field in GkrellmLauncher is only accessed by the plugin itself, so replacing it with void should be binary compatible. I am attaching a work-in-progress patch replacing GtkItemFactory with GtkUIManager and GtkTooltips with gtk_tooltip_... functions. With the patch applied, GKrellM is still not GTK3 compatible, but at least the public API is free of deprecated GTK stuff . Regards, -- Jindrich Makovicka
gkrellm-remove-itemfactory-tooltips.diff
(text/x-patch, 22.3 KB)
diff -ur gkrellm-2.3.5.orig/src/chart.c gkrellm-2.3.5/src/chart.c
--- gkrellm-2.3.5.orig/src/chart.c 2010-09-14 18:25:51.000000000 +0200
+++ gkrellm-2.3.5/src/chart.c 2010-10-28 21:13:36.522891817 +0200
@@ -2303,15 +2303,15 @@
{
GtkWidget *w;
- if (!cf->auto_resolution_item_factory)
+ if (!cf->auto_resolution_ui_manager)
return;
- w = gtk_item_factory_get_widget(cf->auto_resolution_item_factory,
- _("/Control/Auto mode sticks at peak value"));
+ w = gtk_ui_manager_get_widget(cf->auto_resolution_ui_manager,
+ "/menubar/Control/AutoModeStickPeak");
GTK_CHECK_MENU_ITEM(w)->active = cf->auto_resolution_stick;
- w = gtk_item_factory_get_widget(cf->auto_resolution_item_factory,
- _("/Control/Auto mode recalibrate"));
+ w = gtk_ui_manager_get_widget(cf->auto_resolution_ui_manager,
+ "/menubar/Control/AutoModeRecalibrate");
if (cf->auto_grid_resolution)
gtk_widget_set_sensitive(w, TRUE);
else
@@ -2418,92 +2418,114 @@
/* =================================================================== */
static void
-cb_auto_res_control(GkrellmChart *cp, guint option, GtkWidget* widget)
- {
- GkrellmChartconfig *cf;
- gint grid_res;
- gboolean active;
-
- cf = cp->config;
- switch (option)
- {
- case 0:
- cp->maxval_auto_base = 0;
- cp->maxval_peak = 0;
- break;
- case 1:
- active = GTK_CHECK_MENU_ITEM(widget)->active;
- cf->auto_resolution_stick = active;
- cp->maxval_auto_base = 0;
- break;
- case 2:
- active = GTK_CHECK_MENU_ITEM(widget)->active;
- if (cf->sequence_125 && active)
- return;
- cf->sequence_125 = active;
- break;
- case 3:
- active = GTK_CHECK_MENU_ITEM(widget)->active;
- if (!cf->sequence_125 && active)
- return;
- cf->sequence_125 = !active;
-
- grid_res = gkrellm_125_sequence(cf->grid_resolution,
- cf->sequence_125, cf->low, cf->high, TRUE, FALSE);
- cf->grid_resolution = grid_res;
- set_grid_resolution_spin_button(cp, grid_res);
- break;
- }
- gkrellm_refresh_chart(cp);
- }
+cb_seq_control(GtkRadioAction *action, GtkRadioAction *current, GkrellmChart *cp )
+{
+ GkrellmChartconfig *cf = cp->config;
+
+ if (cf->sequence_125 == gtk_radio_action_get_current_value(action))
+ return;
+ cf->sequence_125 = gtk_radio_action_get_current_value(action);
+
+ cf->grid_resolution = gkrellm_125_sequence(cf->grid_resolution,
+ cf->sequence_125, cf->low, cf->high, TRUE, FALSE);
+ set_grid_resolution_spin_button(cp, cf->grid_resolution);
+}
+static void
+cb_auto_stick_control(GtkToggleAction *action, GkrellmChart *cp )
+{
+ GkrellmChartconfig *cf = cp->config;
+
+ cf->auto_resolution_stick = gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action));
+ cp->maxval_auto_base = 0;
+ gkrellm_refresh_chart(cp);
+}
-static GtkItemFactoryEntry auto_res_control_items[] =
- {
-{N_("/Control"), NULL, NULL, 0, "<LastBranch>" },
-{N_("/Control/-"), NULL, NULL, 0, "<Separator>"},
-{N_("/Control/Auto mode recalibrate"),
- NULL, cb_auto_res_control, 0, "<Item>"},
-{N_("/Control/Auto mode sticks at peak value"),
- NULL, cb_auto_res_control, 1, "<ToggleItem>"},
-{N_("/Control/-"), NULL, NULL, 0, "<Separator>"},
-{N_("/Control/Sequence.../1 2 5"),
- NULL, cb_auto_res_control, 2, "<RadioItem>"},
-{N_("/Control/Sequence.../1 1.5 2 3 5 7"),
- NULL, cb_auto_res_control, 3,
- N_("/Control/Sequence.../1 2 5")},
-{N_("/Control/-"), NULL, NULL, 0, "<Separator>"},
- };
+static void
+cb_auto_res_control(GtkAction *action, GkrellmChart *cp )
+{
+ cp->maxval_auto_base = 0;
+ cp->maxval_peak = 0;
+ gkrellm_refresh_chart(cp);
+}
+
+static const char *auto_res_control_items = "\
+<ui>\
+ <menubar>\
+ <menu name=\"Control\" action=\"ControlAction\">\
+ <separator/>\
+ <menuitem name=\"AutoModeRecalibrate\" action=\"AutoModeRecalibrateAction\"/>\
+ <menuitem name=\"AutoModeStickPeak\" action=\"AutoModeStickPeakAction\"/>\
+ <menu name=\"SequenceMenu\" action=\"SequenceMenuAction\">\
+ <menuitem name=\"Seq125\" action=\"Seq125Action\"/>\
+ <menuitem name=\"Seq1357\" action=\"Seq1357Action\"/>\
+ </menu>\
+ <separator/>\
+ </menu>\
+ </menubar>\
+</ui>\
+";
+
+static GtkActionEntry auto_res_control_entries[] =
+{
+ { "ControlAction", NULL, N_("Control"),
+ NULL, NULL, G_CALLBACK(NULL) },
+ { "SequenceMenuAction", NULL, N_("Sequence..."),
+ NULL, NULL, G_CALLBACK(NULL) },
+ { "AutoModeRecalibrateAction", NULL, N_("Auto mode recalibrate"),
+ NULL, NULL, G_CALLBACK(cb_auto_res_control) },
+};
+static guint n_auto_res_control_entries = G_N_ELEMENTS (auto_res_control_entries);
+
+static GtkToggleActionEntry auto_res_control_toggle_entries[] =
+{
+ { "AutoModeStickPeakAction", NULL, N_("Auto mode sticks at peak value"),
+ NULL, NULL, G_CALLBACK(cb_auto_stick_control), FALSE },
+};
+static guint n_auto_res_control_toggle_entries = G_N_ELEMENTS (auto_res_control_toggle_entries);
+
+static GtkRadioActionEntry auto_res_control_radio_entries[] =
+{
+ { "Seq125Action", NULL, N_("1 2 5"),
+ NULL, NULL, 1 },
+ { "Seq1357Action", NULL, N_("1 1.5 2 3 5 7"),
+ NULL, NULL, 0 },
+};
+static guint n_auto_res_control_radio_entries = G_N_ELEMENTS (auto_res_control_radio_entries);
static void
auto_resolution_control_menubar(GtkWidget **menubar, GkrellmChart *cp)
{
- GtkItemFactory *item_factory;
+ GtkUIManager *ui_manager;
+ GtkActionGroup *action_group;
GkrellmChartconfig *cf = cp->config;
- gint i, n;
- static gboolean translated;
+ GError *error;
- n = sizeof(auto_res_control_items) / sizeof(GtkItemFactoryEntry);
- item_factory = gtk_item_factory_new(GTK_TYPE_MENU_BAR, "<main>", NULL);
- if (!translated)
- {
- for(i = 0; i < n; i++)
- auto_res_control_items[i].path = _(auto_res_control_items[i].path);
- auto_res_control_items[6].item_type =
- _(auto_res_control_items[6].item_type);
- translated = TRUE;
- }
- gtk_item_factory_create_items(item_factory, n, auto_res_control_items, cp);
- cf->auto_resolution_item_factory = item_factory;
+ action_group = gtk_action_group_new ("ControlActions");
+ gtk_action_group_add_actions (action_group, auto_res_control_entries,
+ n_auto_res_control_entries, cp);
+ gtk_action_group_add_toggle_actions (action_group, auto_res_control_toggle_entries,
+ n_auto_res_control_toggle_entries, cp);
+ gtk_action_group_add_radio_actions (action_group, auto_res_control_radio_entries,
+ n_auto_res_control_radio_entries,
+ !!cf->sequence_125, G_CALLBACK(cb_seq_control),
+ cp);
+ ui_manager = gtk_ui_manager_new ();
+ error = NULL;
+ gtk_ui_manager_add_ui_from_string (ui_manager, auto_res_control_items,
+ strlen(auto_res_control_items), &error);
+ if (error)
+ {
+ g_message ("building menus failed: %s", error->message);
+ g_error_free (error);
+ return;
+ }
+ gtk_ui_manager_insert_action_group (ui_manager, action_group, 0);
+ cf->auto_resolution_ui_manager = ui_manager;
set_resolution_menubar_items_sensitivity(cf);
- GTK_CHECK_MENU_ITEM(gtk_item_factory_get_widget(item_factory,
- _("/Control/Sequence.../1 2 5")))->active = cf->sequence_125;
- GTK_CHECK_MENU_ITEM(gtk_item_factory_get_widget(item_factory,
- _("/Control/Sequence.../1 1.5 2 3 5 7")))->active = !cf->sequence_125;
-
if (menubar)
- *menubar = gtk_item_factory_get_widget(item_factory, "<main>");
+ *menubar = gtk_ui_manager_get_widget(ui_manager, "/menubar");
}
void
@@ -2590,7 +2612,7 @@
}
cf->auto_resolution_control_menubar = NULL;
- cf->auto_resolution_item_factory = NULL;
+ cf->auto_resolution_ui_manager = NULL;
cf->grid_resolution_spin_button = NULL;
cf->fixed_grids_spin_button = NULL;
diff -ur gkrellm-2.3.5.orig/src/disk.c gkrellm-2.3.5/src/disk.c
--- gkrellm-2.3.5.orig/src/disk.c 2010-10-02 18:21:01.000000000 +0200
+++ gkrellm-2.3.5/src/disk.c 2010-10-28 18:49:11.765941292 +0200
@@ -725,7 +725,6 @@
if (disk->launch.button)
gkrellm_destroy_button(disk->launch.button);
disk->launch.button = NULL;
- disk->launch.tooltip = NULL;
gkrellm_dup_string(&disk->launch.command, "");
gkrellm_dup_string(&disk->launch.tooltip_comment, "");
gkrellm_chart_destroy(disk->chart);
diff -ur gkrellm-2.3.5.orig/src/gkrellm.h gkrellm-2.3.5/src/gkrellm.h
--- gkrellm-2.3.5.orig/src/gkrellm.h 2010-10-02 18:21:01.000000000 +0200
+++ gkrellm-2.3.5/src/gkrellm.h 2010-10-28 19:10:10.576929558 +0200
@@ -568,7 +568,7 @@
gpointer cb_grid_resolution_data;
GtkWidget *grid_resolution_spin_button;
GtkWidget *auto_resolution_control_menubar;
- GtkItemFactory *auto_resolution_item_factory;
+ GtkUIManager *auto_resolution_ui_manager;
gchar *grid_resolution_label;
gboolean adjustment_is_set;
gboolean map_sequence;
@@ -775,7 +775,7 @@
gint pad;
FILE *pipe; /* Read the output of some commands */
GkrellmDecalbutton *button;
- GtkTooltips *tooltip;
+ void *tooltip_filler;
gchar *tooltip_comment;
GkrellmDecal *decal; /* Used if DECAL_LAUNCHER type */
GkrellmMargin margin;
diff -ur gkrellm-2.3.5.orig/src/gkrellm-private.h gkrellm-2.3.5/src/gkrellm-private.h
--- gkrellm-2.3.5.orig/src/gkrellm-private.h 2010-09-14 18:25:51.000000000 +0200
+++ gkrellm-2.3.5/src/gkrellm-private.h 2010-10-28 17:51:10.803550266 +0200
@@ -437,7 +437,7 @@
void gkrellm_set_theme_alternatives_label(void);
void gkrellm_start_timer(gint);
-GtkItemFactory *gkrellm_create_item_factory_popup(void);
+GtkUIManager *gkrellm_create_ui_manager_popup(void);
void gkrellm_apply_hostname_config(void);
gboolean gkrellm_hostname_can_shorten(void);
diff -ur gkrellm-2.3.5.orig/src/gui.c gkrellm-2.3.5/src/gui.c
--- gkrellm-2.3.5.orig/src/gui.c 2010-09-14 23:01:17.000000000 +0200
+++ gkrellm-2.3.5/src/gui.c 2010-10-28 21:14:27.458450297 +0200
@@ -300,32 +300,20 @@
if (launch->button)
gkrellm_destroy_button(launch->button);
launch->button = NULL;
- if (launch->tooltip)
- gtk_tooltips_set_tip(launch->tooltip, launch->widget, NULL, NULL);
}
void
gkrellm_configure_tooltip(GkrellmPanel *p, GkrellmLauncher *launch)
{
launch->widget = p->drawing_area;
- if (!launch->tooltip)
- {
- if (*launch->tooltip_comment && *launch->command)
- {
- launch->tooltip = gtk_tooltips_new();
- gtk_tooltips_set_tip(launch->tooltip, p->drawing_area,
- launch->tooltip_comment, NULL);
- }
- return;
- }
if (*launch->tooltip_comment && *launch->command)
- {
- gtk_tooltips_set_tip(launch->tooltip, p->drawing_area,
- launch->tooltip_comment, NULL);
- gtk_tooltips_enable(launch->tooltip);
- }
+ {
+ gtk_widget_set_tooltip_text(p->drawing_area,
+ launch->tooltip_comment);
+ }
else
- gtk_tooltips_disable(launch->tooltip);
+ gtk_widget_set_tooltip_text(p->drawing_area,
+ NULL);
}
void
@@ -1181,14 +1169,6 @@
/* ------------------Themes Tab----------------------------------*/
-#define THEME_SCALE_UP 0
-#define THEME_SCALE_DOWN 1
-#define THEME_RELOAD 2
-#define THEME_NEXT 3
-#define THEME_PREV 4
-#define THEME_ALT_NEXT 5
-#define THEME_ALT_PREV 6
-
enum
{
THEME_COLUMN,
@@ -1723,40 +1703,40 @@
}
static void
-cb_load_theme(gpointer data, guint action, GtkWidget *widget)
+cb_load_theme(GtkAction *action, GtkWidget *widget)
{
GtkTreeIter iter;
GtkTreeModel *model;
GtkTreePath *path;
Theme *theme;
gint row;
+ const gchar *act = gtk_action_get_name(action);
++_GK.theme_reload_count;
if (_GK.no_config)
return;
if (!themes_list)
gkrellm_make_themes_list();
- if (action == THEME_ALT_NEXT || action == THEME_ALT_PREV)
+ if (strcmp(act, "ThemeAltNextAction") == 0 || strcmp(act, "ThemeAltPrevAction") == 0)
{
- _GK.theme_alternative += ((action == THEME_ALT_NEXT) ? 1 : -1);
+ _GK.theme_alternative += ((strcmp(act, "ThemeAltNextAction") == 0) ? 1 : -1);
if (_GK.theme_alternative > _GK.theme_n_alternatives)
{
_GK.theme_alternative = 0;
- action = THEME_NEXT;
+ act = "ThemeNextAction";
}
if (_GK.theme_alternative < 0)
{
_GK.theme_alternative = 100;
- action = THEME_PREV;
+ act = "ThemePrevAction";
}
theme_modified = TRUE;
}
- else if (action > THEME_RELOAD)
- _GK.theme_alternative = 0;
- if (action == THEME_NEXT || action == THEME_PREV)
+ if (strcmp(act, "ThemeNextAction") == 0 || strcmp(act, "ThemePrevAction") == 0)
{
- if (action == THEME_NEXT)
+ _GK.theme_alternative = 0;
+ if (strcmp(act, "ThemeNextAction") == 0)
{
theme_position_in_list = theme_position_in_list->next;
if (!theme_position_in_list)
@@ -1782,12 +1762,12 @@
strcmp(theme->path, "Default") ? theme->path : "");
theme_modified = TRUE;
}
- if (action == THEME_SCALE_UP && _GK.theme_scale < 380)
+ if (strcmp(act, "ThemeScaleUp") == 0 && _GK.theme_scale < 380)
{
_GK.theme_scale += 20;
theme_modified = TRUE;
}
- else if (action == THEME_SCALE_DOWN && _GK.theme_scale > 50)
+ else if (strcmp(act, "ThemeScaleDn") == 0 && _GK.theme_scale > 50)
{
_GK.theme_scale -= 20;
theme_modified = TRUE;
@@ -2465,72 +2445,99 @@
gtk_tree_view_set_cursor(treeview, path, NULL, FALSE);
}
-static GtkItemFactoryEntry no_config_items[] =
- {
-{"/-", NULL, NULL, 0, "<Separator>"},
-{N_("/Quit"), NULL, gtk_main_quit, 0, "<Item>"},
-{"/-", NULL, NULL, 0, "<Separator>"},
- };
-
-static GtkItemFactoryEntry menu_items[] =
- {
-{"/-", NULL, NULL, 0, "<Separator>"},
-{N_("/Configuration"), "F1", create_config_window, 0, "<Item>"},
-{N_("/Theme/Prev"), "Page_Up", cb_load_theme, THEME_ALT_PREV, "<Item>"},
-{N_("/Theme/Next"), "Page_Down", cb_load_theme, THEME_ALT_NEXT, "<Item>"},
-{"/-", NULL, NULL, 0, "<Separator>"},
-{N_("/Quit"), NULL, gtk_main_quit, 0, "<Item>"},
-{"/-", NULL, NULL, 0, "<Separator>"},
- };
-
-static GtkItemFactoryEntry debug_items[] =
- {
-{"/-", NULL, NULL, 0, "<Separator>"},
-{N_("/Theme prev"), "<control>Page_Up", cb_load_theme, THEME_PREV, "<Item>"},
-{N_("/Theme next"), "<control>Page_Down", cb_load_theme, THEME_NEXT, "<Item>"},
-{"/Menu Popup", "F2", gkrellm_menu_popup, 0, "<Item>"},
-{"/Reload Theme", "F5", cb_load_theme, THEME_RELOAD, "<Item>"},
-{"/Scale Theme Up", "F6", cb_load_theme, THEME_SCALE_UP, "<Item>"},
-{"/Scale Theme Dn", "F7", cb_load_theme, THEME_SCALE_DOWN, "<Item>"}
- };
-
-static GtkItemFactory *debug_factory;
+static const char *ui_items_no_config = "\
+<ui>\
+ <popup>\
+ <separator/>\
+ <menuitem name=\"Quit\" action=\"QuitAction\"/>\
+ <separator/>\
+ </popup>\
+</ui>\
+";
+
+static const char *ui_items = "\
+<ui>\
+ <popup accelerators=\"true\">\
+ <menuitem name=\"Configuration\" action=\"ConfigurationAction\"/>\
+ <menu name=\"ThemeMenu\" action=\"ThemeMenuAction\">\
+ <menuitem name=\"ThemeAltNext\" action=\"ThemeAltNextAction\"/>\
+ <menuitem name=\"ThemeAltPrev\" action=\"ThemeAltPrevAction\"/>\
+ </menu>\
+ <separator/>\
+ <menuitem name=\"Quit\" action=\"QuitAction\"/>\
+ </popup>\
+</ui>\
+";
+
+/*
+static const char *ui_items_debug = "\
+ <popup>\
+ <menuitem name=\"ThemeNext\" action=\"ThemeNextAction\"/>\
+ <menuitem name=\"ThemePrev\" action=\"ThemePrevAction\"/>\
+ <menuitem name=\"MenuPopup\" action=\"MenuPopupAction\"/>\
+ <menuitem name=\"ReloadTheme\" action=\"ReloadThemeAction\"/>\
+ <menuitem name=\"ScaleThemeUp\" action=\"ScaleThemeUpAction\"/>\
+ <menuitem name=\"ScaleThemeDn\" action=\"ScaleThemeDnAction\"/>\
+ </popup>\
+";
+*/
+static GtkActionEntry ui_entries[] =
+{
+ { "QuitAction", NULL, N_("Quit"),
+ NULL, NULL, G_CALLBACK(gtk_main_quit) },
+ { "ConfigurationAction", NULL, N_("Configuration"),
+ "F1", NULL, G_CALLBACK(create_config_window) },
+ { "ThemeMenuAction", NULL, N_("Theme"),
+ NULL, NULL, NULL },
+ { "ThemeAltNextAction", NULL, N_("Next"),
+ "Page_Up", NULL, G_CALLBACK(cb_load_theme) },
+ { "ThemeAltPrevAction", NULL, N_("Prev"),
+ "Page_Down", NULL, G_CALLBACK(cb_load_theme) },
+ { "ThemeNextAction", NULL, N_("Theme next"),
+ "<control>Page_Up", NULL, G_CALLBACK(cb_load_theme) },
+ { "ThemePrevAction", NULL, N_("Theme prev"),
+ "<control>Page_Down", NULL, G_CALLBACK(cb_load_theme) },
+ { "MenuPopupAction", NULL, N_("Menu Popup"),
+ "F2", NULL, G_CALLBACK(cb_load_theme) },
+ { "ReloadThemeAction", NULL, N_("Reload Theme"),
+ "F5", NULL, G_CALLBACK(cb_load_theme) },
+ { "ScaleThemeUpAction", NULL, N_("Scale Theme Up"),
+ "F6", NULL, G_CALLBACK(cb_load_theme) },
+ { "ScaleThemeDnAction", NULL, N_("Scale Theme Dn"),
+ "F7", NULL, G_CALLBACK(cb_load_theme) },
+};
+static guint n_ui_entries = G_N_ELEMENTS (ui_entries);
-GtkItemFactory *
-gkrellm_create_item_factory_popup(void)
+GtkUIManager *
+gkrellm_create_ui_manager_popup(void)
{
GtkWidget *top_win;
- GtkItemFactory *item_factory;
- GtkAccelGroup *accel_group;
- gint n,i;
+ GtkUIManager *ui_manager;
+ GtkActionGroup *action_group;
+ GError *error;
top_win = gkrellm_get_top_window();
- accel_group = gtk_accel_group_new ();
- gtk_window_add_accel_group(GTK_WINDOW(top_win), accel_group);
-
- n = sizeof(debug_items) / sizeof (GtkItemFactoryEntry);
- debug_factory = gtk_item_factory_new(GTK_TYPE_MENU, "<Main>", accel_group);
- gtk_item_factory_create_items(debug_factory, n, debug_items, NULL);
+ action_group = gtk_action_group_new ("UiActions");
+ gtk_action_group_add_actions (action_group, ui_entries, n_ui_entries, NULL);
+ ui_manager = gtk_ui_manager_new ();
+ gtk_ui_manager_insert_action_group (ui_manager, action_group, 0);
+ error = NULL;
+ if (_GK.no_config)
+ gtk_ui_manager_add_ui_from_string (ui_manager, ui_items_no_config,
+ strlen(ui_items_no_config), &error);
+ else
+ gtk_ui_manager_add_ui_from_string (ui_manager, ui_items,
+ strlen(ui_items), &error);
+ if (error)
+ {
+ g_message ("building menus failed: %s", error->message);
+ g_error_free (error);
+ return NULL;
+ }
+ gtk_window_add_accel_group(GTK_WINDOW(top_win),
+ gtk_ui_manager_get_accel_group (ui_manager));
- if (_GK.no_config)
- {
- n = sizeof(no_config_items) / sizeof (GtkItemFactoryEntry);
- item_factory = gtk_item_factory_new(GTK_TYPE_MENU, "<Main>",
- accel_group);
- for(i = 0; i < n; i++)
- no_config_items[i].path = _(no_config_items[i].path);
- gtk_item_factory_create_items(item_factory, n, no_config_items, NULL);
- }
- else
- {
- n = sizeof(menu_items) / sizeof (GtkItemFactoryEntry);
- item_factory = gtk_item_factory_new(GTK_TYPE_MENU, "<Main>",
- accel_group);
- for(i = 0; i < n; i++)
- menu_items[i].path = _(menu_items[i].path);
- gtk_item_factory_create_items(item_factory, n, menu_items, NULL);
- }
- return item_factory;
+ return ui_manager;
}
diff -ur gkrellm-2.3.5.orig/src/inet.c gkrellm-2.3.5/src/inet.c
--- gkrellm-2.3.5.orig/src/inet.c 2010-09-14 18:25:51.000000000 +0200
+++ gkrellm-2.3.5/src/inet.c 2010-10-28 18:49:29.041123462 +0200
@@ -846,7 +846,6 @@
g_free(in->launch.command);
if (in->launch.button)
gkrellm_destroy_button(in->launch.button);
- in->launch.tooltip = NULL;
g_free(in->mark_data);
/* The panel doesn't live in the chart struct, so destroy it separately
diff -ur gkrellm-2.3.5.orig/src/main.c gkrellm-2.3.5/src/main.c
--- gkrellm-2.3.5.orig/src/main.c 2010-10-02 18:12:40.000000000 +0200
+++ gkrellm-2.3.5/src/main.c 2010-10-28 20:48:43.114803769 +0200
@@ -88,7 +88,7 @@
GList *gkrellm_monitor_list;
time_t gkrellm_time_now;
-static GtkItemFactory *item_factory;
+static GtkUIManager *ui_manager;
static gchar *geometry;
@@ -602,7 +602,7 @@
void
gkrellm_menu_popup(void)
{
- gtk_menu_popup(GTK_MENU(item_factory->widget), NULL, NULL, NULL, NULL,
+ gtk_menu_popup(GTK_MENU(gtk_ui_manager_get_widget(ui_manager, "/popup")), NULL, NULL, NULL, NULL,
0, gtk_get_current_event_time());
}
@@ -639,7 +639,7 @@
if (ev->button == 3)
{
- gtk_menu_popup(GTK_MENU(item_factory->widget), NULL, NULL, NULL, NULL,
+ gtk_menu_popup(GTK_MENU(gtk_ui_manager_get_widget(ui_manager, "/popup")), NULL, NULL, NULL, NULL,
ev->button, ev->time);
return FALSE;
}
@@ -755,7 +755,7 @@
if (ev->button == 3)
{
- gtk_menu_popup(GTK_MENU(item_factory->widget), NULL, NULL, NULL, NULL,
+ gtk_menu_popup(GTK_MENU(gtk_ui_manager_get_widget(ui_manager, "/popup")), NULL, NULL, NULL, NULL,
ev->button, ev->time);
return FALSE;
}
@@ -2324,7 +2324,7 @@
g_signal_connect(G_OBJECT(gtree.right_event_box), "button_press_event",
G_CALLBACK(side_frame_button_press), NULL );
- item_factory = gkrellm_create_item_factory_popup();
+ ui_manager = gkrellm_create_ui_manager_popup();
if (_GK.sticky_state)
gtk_window_stick(GTK_WINDOW(top_window));
diff -ur gkrellm-2.3.5.orig/src/Makefile gkrellm-2.3.5/src/Makefile
--- gkrellm-2.3.5.orig/src/Makefile 2010-10-02 18:21:01.000000000 +0200
+++ gkrellm-2.3.5/src/Makefile 2010-10-28 17:52:09.624554252 +0200
@@ -170,7 +170,7 @@
LINK_FLAGS="-Wl,-bind_at_load" \
X11_LIBS="" \
UNIXOBJS="" \
- gkrellm
+ gkrellm
netbsd1:
$(MAKE) EXTRAOBJS= SYS_LIBS="-lkvm" \
diff -ur gkrellm-2.3.5.orig/src/net.c gkrellm-2.3.5/src/net.c
--- gkrellm-2.3.5.orig/src/net.c 2010-09-14 18:25:51.000000000 +0200
+++ gkrellm-2.3.5/src/net.c 2010-10-28 18:49:49.612531245 +0200
@@ -1140,7 +1140,6 @@
if (cp)
{
net->launch.button = NULL;
- net->launch.tooltip = NULL;
g_free(cp->panel->textstyle);
cp->panel->textstyle = NULL;
gkrellm_chart_destroy(cp);
diff -ur gkrellm-2.3.5.orig/src/proc.c gkrellm-2.3.5/src/proc.c
--- gkrellm-2.3.5.orig/src/proc.c 2010-09-14 18:25:51.000000000 +0200
+++ gkrellm-2.3.5/src/proc.c 2010-10-28 18:50:00.173253970 +0200
@@ -380,7 +380,6 @@
if (proc_launch.button)
gkrellm_destroy_button(proc_launch.button);
proc_launch.button = NULL;
- proc_launch.tooltip = NULL;
gkrellm_chart_destroy(cp);
proc.chart = NULL;
proc.enabled = FALSE;