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:
parent
421cb3102e
commit
873fed3c1e
|
@ -2,6 +2,9 @@ GKrellM Changelog
|
|||
-----------------
|
||||
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.
|
||||
* Translation updates
|
||||
o ru.po from Roman Savochenko
|
||||
|
|
|
@ -534,8 +534,8 @@ update_battery(void)
|
|||
static gboolean
|
||||
cb_expose_event(GtkWidget *widget, GdkEventExpose *ev, GkrellmPanel *p)
|
||||
{
|
||||
gdk_draw_drawable(widget->window,
|
||||
widget->style->fg_gc[GTK_WIDGET_STATE(widget)], p->pixmap,
|
||||
gdk_draw_drawable(gtk_widget_get_window(widget),
|
||||
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.width, ev->area.height);
|
||||
return FALSE;
|
||||
|
|
172
src/chart.c
172
src/chart.c
|
@ -2303,15 +2303,15 @@ set_resolution_menubar_items_sensitivity(GkrellmChartconfig *cf)
|
|||
{
|
||||
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 @@ cb_split_fraction(GtkWidget *adjustment, GkrellmChartdata *cd)
|
|||
/* =================================================================== */
|
||||
|
||||
static void
|
||||
cb_auto_res_control(GkrellmChart *cp, guint option, GtkWidget* widget)
|
||||
{
|
||||
GkrellmChartconfig *cf;
|
||||
gint grid_res;
|
||||
gboolean active;
|
||||
cb_seq_control(GtkRadioAction *action, GtkRadioAction *current, GkrellmChart *cp )
|
||||
{
|
||||
GkrellmChartconfig *cf = cp->config;
|
||||
|
||||
cf = cp->config;
|
||||
switch (option)
|
||||
{
|
||||
case 0:
|
||||
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 void
|
||||
cb_auto_res_control(GtkAction *action, GkrellmChart *cp )
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
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 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 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)
|
||||
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)
|
||||
{
|
||||
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;
|
||||
g_message ("building menus failed: %s", error->message);
|
||||
g_error_free (error);
|
||||
return;
|
||||
}
|
||||
gtk_item_factory_create_items(item_factory, n, auto_res_control_items, cp);
|
||||
cf->auto_resolution_item_factory = item_factory;
|
||||
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 @@ gkrellm_chartconfig_window_create(GkrellmChart *cp)
|
|||
}
|
||||
|
||||
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;
|
||||
|
||||
|
|
|
@ -725,7 +725,6 @@ destroy_disk_monitor(DiskMon *disk)
|
|||
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);
|
||||
|
|
|
@ -437,7 +437,7 @@ void gkrellm_remove_plugin_config_page(GkrellmMonitor *);
|
|||
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);
|
||||
|
|
|
@ -568,7 +568,7 @@ typedef struct
|
|||
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 @@ typedef struct
|
|||
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;
|
||||
|
|
187
src/gui.c
187
src/gui.c
|
@ -300,32 +300,20 @@ gkrellm_remove_launcher(GkrellmLauncher *launch)
|
|||
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 @@ _("Some of these properties require a standards compliant window manager.\n"
|
|||
|
||||
/* ------------------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 @@ gkrellm_read_theme_event(GtkSettings *settings)
|
|||
}
|
||||
|
||||
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 @@ cb_load_theme(gpointer data, guint action, GtkWidget *widget)
|
|||
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 @@ gkrellm_open_config_window(GkrellmMonitor *mon)
|
|||
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 const char *ui_items_no_config = "\
|
||||
<ui>\
|
||||
<popup>\
|
||||
<separator/>\
|
||||
<menuitem name=\"Quit\" action=\"QuitAction\"/>\
|
||||
<separator/>\
|
||||
</popup>\
|
||||
</ui>\
|
||||
";
|
||||
|
||||
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 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 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 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 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);
|
||||
|
||||
|
||||
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)
|
||||
{
|
||||
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);
|
||||
}
|
||||
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)
|
||||
{
|
||||
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);
|
||||
g_message ("building menus failed: %s", error->message);
|
||||
g_error_free (error);
|
||||
return NULL;
|
||||
}
|
||||
return item_factory;
|
||||
gtk_window_add_accel_group(GTK_WINDOW(top_win),
|
||||
gtk_ui_manager_get_accel_group (ui_manager));
|
||||
|
||||
return ui_manager;
|
||||
}
|
||||
|
||||
|
|
|
@ -846,7 +846,6 @@ destroy_inet_monitor(InetMon *in)
|
|||
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
|
||||
|
|
16
src/main.c
16
src/main.c
|
@ -88,7 +88,7 @@ static GtkWidget *top_window;
|
|||
GList *gkrellm_monitor_list;
|
||||
time_t gkrellm_time_now;
|
||||
|
||||
static GtkItemFactory *item_factory;
|
||||
static GtkUIManager *ui_manager;
|
||||
|
||||
static gchar *geometry;
|
||||
|
||||
|
@ -401,17 +401,17 @@ update_monitors()
|
|||
void
|
||||
gkrellm_start_timer(gint Hz)
|
||||
{
|
||||
static gint timeout_id = 0;
|
||||
static guint timeout_id = 0;
|
||||
gint interval;
|
||||
|
||||
if (timeout_id)
|
||||
gtk_timeout_remove(timeout_id);
|
||||
g_source_remove(timeout_id);
|
||||
timeout_id = 0;
|
||||
if (Hz > 0)
|
||||
{
|
||||
interval = 1000 / Hz;
|
||||
interval = interval * 60 / 63; /* Compensate for overhead XXX */
|
||||
timeout_id = gtk_timeout_add(interval,
|
||||
timeout_id = g_timeout_add(interval,
|
||||
(GtkFunction) update_monitors,NULL);
|
||||
}
|
||||
}
|
||||
|
@ -602,7 +602,7 @@ gkrellm_motion(GtkWidget *widget, GdkEventMotion *ev, gpointer data)
|
|||
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 @@ top_frame_button_press(GtkWidget *widget, GdkEventButton *ev, gpointer data)
|
|||
|
||||
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 @@ side_frame_button_press(GtkWidget *widget, GdkEventButton *ev, gpointer data)
|
|||
|
||||
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 @@ main(gint argc, gchar **argv)
|
|||
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));
|
||||
|
|
|
@ -1140,7 +1140,6 @@ destroy_chart(NetMon *net)
|
|||
if (cp)
|
||||
{
|
||||
net->launch.button = NULL;
|
||||
net->launch.tooltip = NULL;
|
||||
g_free(cp->panel->textstyle);
|
||||
cp->panel->textstyle = NULL;
|
||||
gkrellm_chart_destroy(cp);
|
||||
|
|
|
@ -380,7 +380,6 @@ destroy_proc_monitor(void)
|
|||
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;
|
||||
|
|
Loading…
Reference in New Issue