Patch from Jindrich Makovicka: update multiple GKrellM files to compile

with -DGTK_DISABLE_DEPRECATED -DGSEAL_ENABLE for GTK3 compatibility.
Replaces GtkItemFactory and GtkTooltips.
This commit is contained in:
Bill Wilson 2011-08-08 15:33:09 -05:00
parent 421cb3102e
commit 873fed3c1e
11 changed files with 219 additions and 191 deletions

View File

@ -2,6 +2,9 @@ GKrellM Changelog
----------------- -----------------
2.3.6 - Not released 2.3.6 - Not released
------------------------ ------------------------
* Patch from Jindrich Makovicka: update multiple GKrellM files to compile
with -DGTK_DISABLE_DEPRECATED -DGSEAL_ENABLE for GTK3 compatibility.
Replaces GtkItemFactory and GtkTooltips.
* Add nvidia-smi interface to linux.c for getting nvidia GPU temperatures. * Add nvidia-smi interface to linux.c for getting nvidia GPU temperatures.
* Translation updates * Translation updates
o ru.po from Roman Savochenko o ru.po from Roman Savochenko

View File

@ -534,8 +534,8 @@ update_battery(void)
static gboolean static gboolean
cb_expose_event(GtkWidget *widget, GdkEventExpose *ev, GkrellmPanel *p) cb_expose_event(GtkWidget *widget, GdkEventExpose *ev, GkrellmPanel *p)
{ {
gdk_draw_drawable(widget->window, gdk_draw_drawable(gtk_widget_get_window(widget),
widget->style->fg_gc[GTK_WIDGET_STATE(widget)], p->pixmap, gtk_widget_get_style(widget)->fg_gc[gtk_widget_get_state(widget)], p->pixmap,
ev->area.x, ev->area.y, ev->area.x, ev->area.y, ev->area.x, ev->area.y, ev->area.x, ev->area.y,
ev->area.width, ev->area.height); ev->area.width, ev->area.height);
return FALSE; return FALSE;

View File

@ -2303,15 +2303,15 @@ set_resolution_menubar_items_sensitivity(GkrellmChartconfig *cf)
{ {
GtkWidget *w; GtkWidget *w;
if (!cf->auto_resolution_item_factory) if (!cf->auto_resolution_ui_manager)
return; return;
w = gtk_item_factory_get_widget(cf->auto_resolution_item_factory, w = gtk_ui_manager_get_widget(cf->auto_resolution_ui_manager,
_("/Control/Auto mode sticks at peak value")); "/menubar/Control/AutoModeStickPeak");
GTK_CHECK_MENU_ITEM(w)->active = cf->auto_resolution_stick; GTK_CHECK_MENU_ITEM(w)->active = cf->auto_resolution_stick;
w = gtk_item_factory_get_widget(cf->auto_resolution_item_factory, w = gtk_ui_manager_get_widget(cf->auto_resolution_ui_manager,
_("/Control/Auto mode recalibrate")); "/menubar/Control/AutoModeRecalibrate");
if (cf->auto_grid_resolution) if (cf->auto_grid_resolution)
gtk_widget_set_sensitive(w, TRUE); gtk_widget_set_sensitive(w, TRUE);
else else
@ -2418,92 +2418,114 @@ cb_split_fraction(GtkWidget *adjustment, GkrellmChartdata *cd)
/* =================================================================== */ /* =================================================================== */
static void static void
cb_auto_res_control(GkrellmChart *cp, guint option, GtkWidget* widget) cb_seq_control(GtkRadioAction *action, GtkRadioAction *current, GkrellmChart *cp )
{ {
GkrellmChartconfig *cf; GkrellmChartconfig *cf = cp->config;
gint grid_res;
gboolean active;
cf = cp->config; if (cf->sequence_125 == gtk_radio_action_get_current_value(action))
switch (option) return;
{ cf->sequence_125 = gtk_radio_action_get_current_value(action);
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->grid_resolution = gkrellm_125_sequence(cf->grid_resolution,
cf->sequence_125, cf->low, cf->high, TRUE, FALSE); cf->sequence_125, cf->low, cf->high, TRUE, FALSE);
cf->grid_resolution = grid_res; set_grid_resolution_spin_button(cp, cf->grid_resolution);
set_grid_resolution_spin_button(cp, grid_res); }
break;
}
gkrellm_refresh_chart(cp);
}
static void
cb_auto_stick_control(GtkToggleAction *action, GkrellmChart *cp )
{
GkrellmChartconfig *cf = cp->config;
static GtkItemFactoryEntry auto_res_control_items[] = cf->auto_resolution_stick = gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action));
{ cp->maxval_auto_base = 0;
{N_("/Control"), NULL, NULL, 0, "<LastBranch>" }, gkrellm_refresh_chart(cp);
{N_("/Control/-"), NULL, NULL, 0, "<Separator>"}, }
{N_("/Control/Auto mode recalibrate"),
NULL, cb_auto_res_control, 0, "<Item>"}, static void
{N_("/Control/Auto mode sticks at peak value"), cb_auto_res_control(GtkAction *action, GkrellmChart *cp )
NULL, cb_auto_res_control, 1, "<ToggleItem>"}, {
{N_("/Control/-"), NULL, NULL, 0, "<Separator>"}, cp->maxval_auto_base = 0;
{N_("/Control/Sequence.../1 2 5"), cp->maxval_peak = 0;
NULL, cb_auto_res_control, 2, "<RadioItem>"}, gkrellm_refresh_chart(cp);
{N_("/Control/Sequence.../1 1.5 2 3 5 7"), }
NULL, cb_auto_res_control, 3,
N_("/Control/Sequence.../1 2 5")}, static const char *auto_res_control_items = "\
{N_("/Control/-"), NULL, NULL, 0, "<Separator>"}, <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 static void
auto_resolution_control_menubar(GtkWidget **menubar, GkrellmChart *cp) auto_resolution_control_menubar(GtkWidget **menubar, GkrellmChart *cp)
{ {
GtkItemFactory *item_factory; GtkUIManager *ui_manager;
GtkActionGroup *action_group;
GkrellmChartconfig *cf = cp->config; GkrellmChartconfig *cf = cp->config;
gint i, n; GError *error;
static gboolean translated;
n = sizeof(auto_res_control_items) / sizeof(GtkItemFactoryEntry); action_group = gtk_action_group_new ("ControlActions");
item_factory = gtk_item_factory_new(GTK_TYPE_MENU_BAR, "<main>", NULL); gtk_action_group_add_actions (action_group, auto_res_control_entries,
if (!translated) n_auto_res_control_entries, cp);
{ gtk_action_group_add_toggle_actions (action_group, auto_res_control_toggle_entries,
for(i = 0; i < n; i++) n_auto_res_control_toggle_entries, cp);
auto_res_control_items[i].path = _(auto_res_control_items[i].path); gtk_action_group_add_radio_actions (action_group, auto_res_control_radio_entries,
auto_res_control_items[6].item_type = n_auto_res_control_radio_entries,
_(auto_res_control_items[6].item_type); !!cf->sequence_125, G_CALLBACK(cb_seq_control),
translated = TRUE; cp);
} ui_manager = gtk_ui_manager_new ();
gtk_item_factory_create_items(item_factory, n, auto_res_control_items, cp); error = NULL;
cf->auto_resolution_item_factory = item_factory; 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); 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) if (menubar)
*menubar = gtk_item_factory_get_widget(item_factory, "<main>"); *menubar = gtk_ui_manager_get_widget(ui_manager, "/menubar");
} }
void void
@ -2590,7 +2612,7 @@ gkrellm_chartconfig_window_create(GkrellmChart *cp)
} }
cf->auto_resolution_control_menubar = NULL; 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->grid_resolution_spin_button = NULL;
cf->fixed_grids_spin_button = NULL; cf->fixed_grids_spin_button = NULL;

View File

@ -725,7 +725,6 @@ destroy_disk_monitor(DiskMon *disk)
if (disk->launch.button) if (disk->launch.button)
gkrellm_destroy_button(disk->launch.button); gkrellm_destroy_button(disk->launch.button);
disk->launch.button = NULL; disk->launch.button = NULL;
disk->launch.tooltip = NULL;
gkrellm_dup_string(&disk->launch.command, ""); gkrellm_dup_string(&disk->launch.command, "");
gkrellm_dup_string(&disk->launch.tooltip_comment, ""); gkrellm_dup_string(&disk->launch.tooltip_comment, "");
gkrellm_chart_destroy(disk->chart); gkrellm_chart_destroy(disk->chart);

View File

@ -437,7 +437,7 @@ void gkrellm_remove_plugin_config_page(GkrellmMonitor *);
void gkrellm_set_theme_alternatives_label(void); void gkrellm_set_theme_alternatives_label(void);
void gkrellm_start_timer(gint); 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); void gkrellm_apply_hostname_config(void);
gboolean gkrellm_hostname_can_shorten(void); gboolean gkrellm_hostname_can_shorten(void);

View File

@ -568,7 +568,7 @@ typedef struct
gpointer cb_grid_resolution_data; gpointer cb_grid_resolution_data;
GtkWidget *grid_resolution_spin_button; GtkWidget *grid_resolution_spin_button;
GtkWidget *auto_resolution_control_menubar; GtkWidget *auto_resolution_control_menubar;
GtkItemFactory *auto_resolution_item_factory; GtkUIManager *auto_resolution_ui_manager;
gchar *grid_resolution_label; gchar *grid_resolution_label;
gboolean adjustment_is_set; gboolean adjustment_is_set;
gboolean map_sequence; gboolean map_sequence;
@ -775,7 +775,7 @@ typedef struct
gint pad; gint pad;
FILE *pipe; /* Read the output of some commands */ FILE *pipe; /* Read the output of some commands */
GkrellmDecalbutton *button; GkrellmDecalbutton *button;
GtkTooltips *tooltip; void *tooltip_filler;
gchar *tooltip_comment; gchar *tooltip_comment;
GkrellmDecal *decal; /* Used if DECAL_LAUNCHER type */ GkrellmDecal *decal; /* Used if DECAL_LAUNCHER type */
GkrellmMargin margin; GkrellmMargin margin;

197
src/gui.c
View File

@ -300,32 +300,20 @@ gkrellm_remove_launcher(GkrellmLauncher *launch)
if (launch->button) if (launch->button)
gkrellm_destroy_button(launch->button); gkrellm_destroy_button(launch->button);
launch->button = NULL; launch->button = NULL;
if (launch->tooltip)
gtk_tooltips_set_tip(launch->tooltip, launch->widget, NULL, NULL);
} }
void void
gkrellm_configure_tooltip(GkrellmPanel *p, GkrellmLauncher *launch) gkrellm_configure_tooltip(GkrellmPanel *p, GkrellmLauncher *launch)
{ {
launch->widget = p->drawing_area; 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) if (*launch->tooltip_comment && *launch->command)
{ {
gtk_tooltips_set_tip(launch->tooltip, p->drawing_area, gtk_widget_set_tooltip_text(p->drawing_area,
launch->tooltip_comment, NULL); launch->tooltip_comment);
gtk_tooltips_enable(launch->tooltip); }
}
else else
gtk_tooltips_disable(launch->tooltip); gtk_widget_set_tooltip_text(p->drawing_area,
NULL);
} }
void void
@ -1181,14 +1169,6 @@ _("Some of these properties require a standards compliant window manager.\n"
/* ------------------Themes Tab----------------------------------*/ /* ------------------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 enum
{ {
THEME_COLUMN, THEME_COLUMN,
@ -1723,40 +1703,40 @@ gkrellm_read_theme_event(GtkSettings *settings)
} }
static void static void
cb_load_theme(gpointer data, guint action, GtkWidget *widget) cb_load_theme(GtkAction *action, GtkWidget *widget)
{ {
GtkTreeIter iter; GtkTreeIter iter;
GtkTreeModel *model; GtkTreeModel *model;
GtkTreePath *path; GtkTreePath *path;
Theme *theme; Theme *theme;
gint row; gint row;
const gchar *act = gtk_action_get_name(action);
++_GK.theme_reload_count; ++_GK.theme_reload_count;
if (_GK.no_config) if (_GK.no_config)
return; return;
if (!themes_list) if (!themes_list)
gkrellm_make_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) if (_GK.theme_alternative > _GK.theme_n_alternatives)
{ {
_GK.theme_alternative = 0; _GK.theme_alternative = 0;
action = THEME_NEXT; act = "ThemeNextAction";
} }
if (_GK.theme_alternative < 0) if (_GK.theme_alternative < 0)
{ {
_GK.theme_alternative = 100; _GK.theme_alternative = 100;
action = THEME_PREV; act = "ThemePrevAction";
} }
theme_modified = TRUE; 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; theme_position_in_list = theme_position_in_list->next;
if (!theme_position_in_list) if (!theme_position_in_list)
@ -1782,12 +1762,12 @@ cb_load_theme(gpointer data, guint action, GtkWidget *widget)
strcmp(theme->path, "Default") ? theme->path : ""); strcmp(theme->path, "Default") ? theme->path : "");
theme_modified = TRUE; 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; _GK.theme_scale += 20;
theme_modified = TRUE; 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; _GK.theme_scale -= 20;
theme_modified = TRUE; theme_modified = TRUE;
@ -2465,72 +2445,99 @@ gkrellm_open_config_window(GkrellmMonitor *mon)
gtk_tree_view_set_cursor(treeview, path, NULL, FALSE); gtk_tree_view_set_cursor(treeview, path, NULL, FALSE);
} }
static GtkItemFactoryEntry no_config_items[] = static const char *ui_items_no_config = "\
{ <ui>\
{"/-", NULL, NULL, 0, "<Separator>"}, <popup>\
{N_("/Quit"), NULL, gtk_main_quit, 0, "<Item>"}, <separator/>\
{"/-", NULL, NULL, 0, "<Separator>"}, <menuitem name=\"Quit\" action=\"QuitAction\"/>\
}; <separator/>\
</popup>\
</ui>\
";
static GtkItemFactoryEntry menu_items[] = static const char *ui_items = "\
{ <ui>\
{"/-", NULL, NULL, 0, "<Separator>"}, <popup accelerators=\"true\">\
{N_("/Configuration"), "F1", create_config_window, 0, "<Item>"}, <menuitem name=\"Configuration\" action=\"ConfigurationAction\"/>\
{N_("/Theme/Prev"), "Page_Up", cb_load_theme, THEME_ALT_PREV, "<Item>"}, <menu name=\"ThemeMenu\" action=\"ThemeMenuAction\">\
{N_("/Theme/Next"), "Page_Down", cb_load_theme, THEME_ALT_NEXT, "<Item>"}, <menuitem name=\"ThemeAltNext\" action=\"ThemeAltNextAction\"/>\
{"/-", NULL, NULL, 0, "<Separator>"}, <menuitem name=\"ThemeAltPrev\" action=\"ThemeAltPrevAction\"/>\
{N_("/Quit"), NULL, gtk_main_quit, 0, "<Item>"}, </menu>\
{"/-", NULL, NULL, 0, "<Separator>"}, <separator/>\
}; <menuitem name=\"Quit\" action=\"QuitAction\"/>\
</popup>\
</ui>\
";
static GtkItemFactoryEntry debug_items[] = /*
{ static const char *ui_items_debug = "\
{"/-", NULL, NULL, 0, "<Separator>"}, <popup>\
{N_("/Theme prev"), "<control>Page_Up", cb_load_theme, THEME_PREV, "<Item>"}, <menuitem name=\"ThemeNext\" action=\"ThemeNextAction\"/>\
{N_("/Theme next"), "<control>Page_Down", cb_load_theme, THEME_NEXT, "<Item>"}, <menuitem name=\"ThemePrev\" action=\"ThemePrevAction\"/>\
{"/Menu Popup", "F2", gkrellm_menu_popup, 0, "<Item>"}, <menuitem name=\"MenuPopup\" action=\"MenuPopupAction\"/>\
{"/Reload Theme", "F5", cb_load_theme, THEME_RELOAD, "<Item>"}, <menuitem name=\"ReloadTheme\" action=\"ReloadThemeAction\"/>\
{"/Scale Theme Up", "F6", cb_load_theme, THEME_SCALE_UP, "<Item>"}, <menuitem name=\"ScaleThemeUp\" action=\"ScaleThemeUpAction\"/>\
{"/Scale Theme Dn", "F7", cb_load_theme, THEME_SCALE_DOWN, "<Item>"} <menuitem name=\"ScaleThemeDn\" action=\"ScaleThemeDnAction\"/>\
}; </popup>\
";
*/
static GtkItemFactory *debug_factory; 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);
GtkUIManager *
GtkItemFactory * gkrellm_create_ui_manager_popup(void)
gkrellm_create_item_factory_popup(void)
{ {
GtkWidget *top_win; GtkWidget *top_win;
GtkItemFactory *item_factory; GtkUIManager *ui_manager;
GtkAccelGroup *accel_group; GtkActionGroup *action_group;
gint n,i; GError *error;
top_win = gkrellm_get_top_window(); top_win = gkrellm_get_top_window();
accel_group = gtk_accel_group_new (); action_group = gtk_action_group_new ("UiActions");
gtk_window_add_accel_group(GTK_WINDOW(top_win), accel_group); 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));
n = sizeof(debug_items) / sizeof (GtkItemFactoryEntry); return ui_manager;
debug_factory = gtk_item_factory_new(GTK_TYPE_MENU, "<Main>", accel_group);
gtk_item_factory_create_items(debug_factory, n, debug_items, NULL);
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;
} }

View File

@ -846,7 +846,6 @@ destroy_inet_monitor(InetMon *in)
g_free(in->launch.command); g_free(in->launch.command);
if (in->launch.button) if (in->launch.button)
gkrellm_destroy_button(in->launch.button); gkrellm_destroy_button(in->launch.button);
in->launch.tooltip = NULL;
g_free(in->mark_data); g_free(in->mark_data);
/* The panel doesn't live in the chart struct, so destroy it separately /* The panel doesn't live in the chart struct, so destroy it separately

View File

@ -88,7 +88,7 @@ static GtkWidget *top_window;
GList *gkrellm_monitor_list; GList *gkrellm_monitor_list;
time_t gkrellm_time_now; time_t gkrellm_time_now;
static GtkItemFactory *item_factory; static GtkUIManager *ui_manager;
static gchar *geometry; static gchar *geometry;
@ -401,17 +401,17 @@ update_monitors()
void void
gkrellm_start_timer(gint Hz) gkrellm_start_timer(gint Hz)
{ {
static gint timeout_id = 0; static guint timeout_id = 0;
gint interval; gint interval;
if (timeout_id) if (timeout_id)
gtk_timeout_remove(timeout_id); g_source_remove(timeout_id);
timeout_id = 0; timeout_id = 0;
if (Hz > 0) if (Hz > 0)
{ {
interval = 1000 / Hz; interval = 1000 / Hz;
interval = interval * 60 / 63; /* Compensate for overhead XXX */ interval = interval * 60 / 63; /* Compensate for overhead XXX */
timeout_id = gtk_timeout_add(interval, timeout_id = g_timeout_add(interval,
(GtkFunction) update_monitors,NULL); (GtkFunction) update_monitors,NULL);
} }
} }
@ -602,7 +602,7 @@ gkrellm_motion(GtkWidget *widget, GdkEventMotion *ev, gpointer data)
void void
gkrellm_menu_popup(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()); 0, gtk_get_current_event_time());
} }
@ -639,7 +639,7 @@ top_frame_button_press(GtkWidget *widget, GdkEventButton *ev, gpointer data)
if (ev->button == 3) 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); ev->button, ev->time);
return FALSE; return FALSE;
} }
@ -755,7 +755,7 @@ side_frame_button_press(GtkWidget *widget, GdkEventButton *ev, gpointer data)
if (ev->button == 3) 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); ev->button, ev->time);
return FALSE; return FALSE;
} }
@ -2324,7 +2324,7 @@ main(gint argc, gchar **argv)
g_signal_connect(G_OBJECT(gtree.right_event_box), "button_press_event", g_signal_connect(G_OBJECT(gtree.right_event_box), "button_press_event",
G_CALLBACK(side_frame_button_press), NULL ); 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) if (_GK.sticky_state)
gtk_window_stick(GTK_WINDOW(top_window)); gtk_window_stick(GTK_WINDOW(top_window));

View File

@ -1140,7 +1140,6 @@ destroy_chart(NetMon *net)
if (cp) if (cp)
{ {
net->launch.button = NULL; net->launch.button = NULL;
net->launch.tooltip = NULL;
g_free(cp->panel->textstyle); g_free(cp->panel->textstyle);
cp->panel->textstyle = NULL; cp->panel->textstyle = NULL;
gkrellm_chart_destroy(cp); gkrellm_chart_destroy(cp);

View File

@ -380,7 +380,6 @@ destroy_proc_monitor(void)
if (proc_launch.button) if (proc_launch.button)
gkrellm_destroy_button(proc_launch.button); gkrellm_destroy_button(proc_launch.button);
proc_launch.button = NULL; proc_launch.button = NULL;
proc_launch.tooltip = NULL;
gkrellm_chart_destroy(cp); gkrellm_chart_destroy(cp);
proc.chart = NULL; proc.chart = NULL;
proc.enabled = FALSE; proc.enabled = FALSE;