[Commits] [SCM] claws branch, gtk3, updated. 3.16.0-75-g0ba0057
ticho at claws-mail.org
ticho at claws-mail.org
Tue Feb 13 18:32:28 CET 2018
The branch, gtk3 has been updated
via 0ba0057777400c02c3aa8429fbb8aa111711bdc9 (commit)
from ecaa1cfbb0ce28ee19e90014fcf05f99e49cf1f6 (commit)
Summary of changes:
src/plugins/acpi_notifier/acpi_notifier.c | 62 +++++++++++------------------
1 file changed, 23 insertions(+), 39 deletions(-)
- Log -----------------------------------------------------------------
commit 0ba0057777400c02c3aa8429fbb8aa111711bdc9
Author: Andrej Kacian <ticho at claws-mail.org>
Date: Tue Feb 13 18:31:24 2018 +0100
Actually get rid of the use of removed GtkCMOPtionMenu in acpi_notifier.
diff --git a/src/plugins/acpi_notifier/acpi_notifier.c b/src/plugins/acpi_notifier/acpi_notifier.c
index 8de12ba..03051a7 100644
--- a/src/plugins/acpi_notifier/acpi_notifier.c
+++ b/src/plugins/acpi_notifier/acpi_notifier.c
@@ -46,6 +46,8 @@
#include "alertpanel.h"
#include "utils.h"
#include "folder_item_prefs.h"
+#include "gtk/gtkutils.h"
+#include "gtk/combobox.h"
#define PREFS_BLOCK_NAME "AcpiNotifier"
#define PLUGIN_NAME _("Acpi Notifier")
@@ -217,20 +219,10 @@ static void show_error (struct AcpiNotifierPage *page, const gchar *filepath)
}
}
-static void type_activated(GtkMenuItem *menuitem, gpointer data)
+static void type_changed(GtkComboBox *combobox, gpointer data)
{
- GtkWidget *menu, *item;
+ gint selected = gtk_combo_box_get_active(combobox);
struct AcpiNotifierPage *page = (struct AcpiNotifierPage *)data;
- gint selected;
-
- if (page->file_entry == NULL)
- return;
-
- menu = gtk_cmoption_menu_get_menu(
- GTK_CMOPTION_MENU(page->default_implementations_optmenu));
- item = gtk_menu_get_active(GTK_MENU(menu));
- selected = GPOINTER_TO_INT
- (g_object_get_data(G_OBJECT(item), MENU_VAL_ID));
if (selected != 0) {
gtk_widget_hide(page->hbox_acpi_file);
@@ -250,6 +242,7 @@ static void type_activated(GtkMenuItem *menuitem, gpointer data)
gtk_widget_show_all(page->hbox_acpi_values);
}
}
+
static void file_entry_changed (GtkWidget *entry, gpointer data)
{
struct AcpiNotifierPage *page = (struct AcpiNotifierPage *)data;
@@ -286,15 +279,15 @@ static void acpi_prefs_create_widget_func(PrefsPage * _page,
GtkWidget *new_mail_blink_btn;
GtkWidget *new_mail_on_btn;
GtkWidget *default_implementations_optmenu;
- GtkWidget *default_implementations_menu;
+ GtkListStore *menu;
GtkWidget *on_value_entry;
GtkWidget *off_value_entry;
GtkWidget *file_entry;
- GtkWidget *menuitem;
GtkWidget *warning_label;
GtkWidget *warning_box;
GtkWidget *image;
GtkWidget *blink_on_err_chkbtn;
+ GtkTreeIter iter; /* iter for the COMBOBOX_ADD macro */
int i;
int found = 0;
@@ -330,17 +323,16 @@ static void acpi_prefs_create_widget_func(PrefsPage * _page,
gtk_widget_set_size_request(on_value_entry, 40, -1);
gtk_widget_set_size_request(off_value_entry, 40, -1);
- default_implementations_optmenu = gtk_cmoption_menu_new ();
- default_implementations_menu = gtk_menu_new();
- gtk_cmoption_menu_set_menu (
- GTK_CMOPTION_MENU(default_implementations_optmenu),
- default_implementations_menu);
+ /* Create the ACPI type menu */
+ default_implementations_optmenu = gtkut_sc_combobox_create(NULL, FALSE);
+ menu = GTK_LIST_STORE(gtk_combo_box_get_model(
+ GTK_COMBO_BOX(default_implementations_optmenu)));
+ g_signal_connect(G_OBJECT(default_implementations_optmenu), "changed",
+ G_CALLBACK(type_changed), page);
+
+ /* Populate it with known implementations */
for (i = 0; known_implementations[i].name != NULL; i++) {
- MENUITEM_ADD (default_implementations_menu,
- menuitem, known_implementations[i].name, i);
- g_signal_connect(G_OBJECT(menuitem), "activate",
- G_CALLBACK(type_activated),
- page);
+ COMBOBOX_ADD(menu, known_implementations[i].name, i);
}
hbox = gtk_hbox_new(FALSE, 6);
@@ -486,9 +478,8 @@ static void acpi_prefs_create_widget_func(PrefsPage * _page,
for (i = 0; known_implementations[i].name != NULL; i++) {
if (!strcmp(acpiprefs.file_path,
known_implementations[i].file_path)) {
- gtk_cmoption_menu_set_history(
- GTK_CMOPTION_MENU(
- default_implementations_optmenu), i);
+ gtk_combo_box_set_active(
+ GTK_COMBO_BOX(default_implementations_optmenu), i);
found = i;
}
}
@@ -496,9 +487,8 @@ static void acpi_prefs_create_widget_func(PrefsPage * _page,
if (found == 0) {
for (i = 0; known_implementations[i].name != NULL; i++) {
if (check_impl(known_implementations[i].file_path)) {
- gtk_cmoption_menu_set_history(
- GTK_CMOPTION_MENU(
- default_implementations_optmenu), i);
+ gtk_combo_box_set_active(
+ GTK_COMBO_BOX(default_implementations_optmenu), i);
found = i;
}
}
@@ -537,8 +527,8 @@ static void acpi_prefs_create_widget_func(PrefsPage * _page,
if (!check_impl(known_implementations[found].file_path))
show_error(page, known_implementations[found].file_path);
} else {
- gtk_cmoption_menu_set_history(
- GTK_CMOPTION_MENU(default_implementations_optmenu), 0);
+ gtk_combo_box_set_active(
+ GTK_COMBO_BOX(default_implementations_optmenu), 0);
gtk_widget_show_all(hbox_acpi_file);
gtk_widget_show_all(hbox_acpi_values);
if (acpiprefs.file_path != NULL)
@@ -564,8 +554,6 @@ static void acpi_prefs_save_func(PrefsPage * _page)
struct AcpiNotifierPage *page = (struct AcpiNotifierPage *) _page;
PrefFile *pfile;
gchar *rcpath;
- GtkWidget *menu;
- GtkWidget *menuitem;
gint selected = 0;
g_free(acpiprefs.file_path);
@@ -611,11 +599,7 @@ static void acpi_prefs_save_func(PrefsPage * _page)
acpiprefs.blink_on_err = gtk_toggle_button_get_active(
GTK_TOGGLE_BUTTON(page->blink_on_err_chkbtn));
- menu = gtk_cmoption_menu_get_menu(
- GTK_CMOPTION_MENU(page->default_implementations_optmenu));
- menuitem = gtk_menu_get_active(GTK_MENU(menu));
- selected = GPOINTER_TO_INT
- (g_object_get_data(G_OBJECT(menuitem), MENU_VAL_ID));
+ selected = gtk_combo_box_get_active(GTK_COMBO_BOX(page->default_implementations_optmenu));
if (selected != 0) {
g_free(acpiprefs.file_path);
-----------------------------------------------------------------------
hooks/post-receive
--
Claws Mail
More information about the Commits
mailing list