wmcliphist: Fix new compiler warnings that appeared after GTK3 transition.

This commit is contained in:
Doug Torrance 2014-11-22 20:48:47 -06:00 committed by Carlos R. Mafra
parent 49f749a29a
commit 5928f82f3e
3 changed files with 21 additions and 31 deletions

View file

@ -4,9 +4,7 @@
/* color of locked item */ /* color of locked item */
gchar locked_color_str[32] = DEF_LOCKED_COLOR; gchar locked_color_str[32] = DEF_LOCKED_COLOR;
GdkColor locked_color; GdkRGBA locked_color;
GtkStyle *style_locked,
*style_normal;
/* Exec on middle click? */ /* Exec on middle click? */
int exec_middleclick = 1; int exec_middleclick = 1;
@ -70,14 +68,16 @@ menu_item_button_released(GtkWidget *widget,
return_val(TRUE); return_val(TRUE);
} }
gtk_widget_set_style(gtk_bin_get_child(GTK_BIN(data->menu_item)), gtk_widget_override_color(
style_locked); gtk_bin_get_child(GTK_BIN(data->menu_item)),
GTK_STATE_FLAG_NORMAL, &locked_color);
data->locked = 1; data->locked = 1;
locked_count++; locked_count++;
} else { } else {
gtk_widget_set_style(gtk_bin_get_child(GTK_BIN(data->menu_item)), gtk_widget_override_color(
style_normal); gtk_bin_get_child(GTK_BIN(data->menu_item)),
GTK_STATE_FLAG_NORMAL, NULL);
data->locked = 0; data->locked = 0;
locked_count--; locked_count--;
} }
@ -213,8 +213,9 @@ menu_item_add(gchar *content, gint locked, GtkWidget *target_menu)
hist_item->menu = target_menu; hist_item->menu = target_menu;
if (locked == 1) { if (locked == 1) {
gtk_widget_set_style(gtk_bin_get_child(GTK_BIN(hist_item->menu_item)), gtk_widget_override_color(
style_locked); gtk_bin_get_child(GTK_BIN(hist_item->menu_item)),
GTK_STATE_FLAG_NORMAL, &locked_color);
locked_count++; locked_count++;
} }
@ -403,12 +404,11 @@ show_message(gchar *message, char *title,
label = gtk_label_new(message); label = gtk_label_new(message);
/* create buttons and set signals */ /* create buttons and set signals */
button_0 = gtk_button_new_with_label(b0_text); gtk_dialog_add_button(GTK_DIALOG(dialog), b0_text, 0);
button_0 = gtk_dialog_get_widget_for_response(GTK_DIALOG(dialog), 0);
g_signal_connect(G_OBJECT(button_0), "clicked", g_signal_connect(G_OBJECT(button_0), "clicked",
G_CALLBACK(dialog_button_press), G_CALLBACK(dialog_button_press),
GINT_TO_POINTER(0)); GINT_TO_POINTER(0));
gtk_container_add(GTK_CONTAINER(gtk_dialog_get_action_area(GTK_DIALOG(dialog))),
button_0);
if (!b2_text) { if (!b2_text) {
g_signal_connect(G_OBJECT(dialog), "key-press-event", g_signal_connect(G_OBJECT(dialog), "key-press-event",
G_CALLBACK(dialog_key_press_yes), G_CALLBACK(dialog_key_press_yes),
@ -416,12 +416,11 @@ show_message(gchar *message, char *title,
} }
if (b1_text != NULL) { if (b1_text != NULL) {
button_1 = gtk_button_new_with_label(b1_text); gtk_dialog_add_button(GTK_DIALOG(dialog), b1_text, 1);
button_1 = gtk_dialog_get_widget_for_response(GTK_DIALOG(dialog), 1);
g_signal_connect(G_OBJECT(button_1), "clicked", g_signal_connect(G_OBJECT(button_1), "clicked",
G_CALLBACK(dialog_button_press), G_CALLBACK(dialog_button_press),
GINT_TO_POINTER(1)); GINT_TO_POINTER(1));
gtk_container_add(GTK_CONTAINER(gtk_dialog_get_action_area(GTK_DIALOG(dialog))),
button_1);
if (!b2_text) { if (!b2_text) {
g_signal_connect(G_OBJECT(dialog), "key-press-event", g_signal_connect(G_OBJECT(dialog), "key-press-event",
G_CALLBACK(dialog_key_press_no), G_CALLBACK(dialog_key_press_no),
@ -430,12 +429,11 @@ show_message(gchar *message, char *title,
} }
if (b2_text) { if (b2_text) {
button_2 = gtk_button_new_with_label(b2_text); gtk_dialog_add_button(GTK_DIALOG(dialog), b2_text, 2);
button_2 = gtk_dialog_get_widget_for_response(GTK_DIALOG(dialog), 2);
g_signal_connect(G_OBJECT(button_2), "clicked", g_signal_connect(G_OBJECT(button_2), "clicked",
G_CALLBACK(dialog_button_press), G_CALLBACK(dialog_button_press),
GINT_TO_POINTER(2)); GINT_TO_POINTER(2));
gtk_container_add(GTK_CONTAINER(gtk_dialog_get_action_area(GTK_DIALOG(dialog))),
button_2);
} }
/* add the label, and show everything we've added to the dialog. */ /* add the label, and show everything we've added to the dialog. */

View file

@ -232,8 +232,7 @@ main(int argc, char **argv)
/* create clipboard history menu */ /* create clipboard history menu */
menu_hist = gtk_menu_new(); menu_hist = gtk_menu_new();
gtk_menu_set_title(GTK_MENU(menu_hist), "Clipboard history"); menu_title = gtk_menu_item_new();
menu_title = gtk_tearoff_menu_item_new();
gtk_menu_shell_append(GTK_MENU_SHELL(menu_hist), menu_title); gtk_menu_shell_append(GTK_MENU_SHELL(menu_hist), menu_title);
gtk_widget_show(menu_title); gtk_widget_show(menu_title);
gtk_widget_show(menu_hist); gtk_widget_show(menu_hist);
@ -279,7 +278,7 @@ main(int argc, char **argv)
gtk_menu_item_set_submenu( gtk_menu_item_set_submenu(
GTK_MENU_ITEM(action->menu_item), GTK_MENU_ITEM(action->menu_item),
action->submenu); action->submenu);
menu_title = gtk_tearoff_menu_item_new(); menu_title = gtk_menu_item_new();
gtk_menu_shell_append(GTK_MENU_SHELL(action->submenu), menu_title); gtk_menu_shell_append(GTK_MENU_SHELL(action->submenu), menu_title);
gtk_widget_show(menu_title); gtk_widget_show(menu_title);
gtk_widget_show(action->menu_item); gtk_widget_show(action->menu_item);
@ -302,7 +301,7 @@ main(int argc, char **argv)
} }
/* prepare colors and styles */ /* prepare colors and styles */
if (gdk_color_parse(locked_color_str, &locked_color) == 0) { if (gdk_rgba_parse(&locked_color, locked_color_str) == FALSE) {
char msg_str[128]; char msg_str[128];
sprintf(msg_str, "Invalid color string: '%s'.\n" sprintf(msg_str, "Invalid color string: '%s'.\n"
@ -310,13 +309,8 @@ main(int argc, char **argv)
locked_color_str); locked_color_str);
show_message(msg_str, "Warning", "OK", NULL, NULL); show_message(msg_str, "Warning", "OK", NULL, NULL);
strcpy(locked_color_str, DEF_LOCKED_COLOR); strcpy(locked_color_str, DEF_LOCKED_COLOR);
gdk_color_parse(locked_color_str, &locked_color); gdk_rgba_parse(&locked_color, locked_color_str);
} }
style_normal = gtk_style_copy(gtk_widget_get_style(menu_hist));
style_locked = gtk_style_copy(gtk_widget_get_style(menu_hist));
style_locked->fg[GTK_STATE_NORMAL] = locked_color;
style_locked->fg[GTK_STATE_PRELIGHT] = locked_color;
/* load previously saved history */ /* load previously saved history */
if (history_load(dump_only) != 0) { if (history_load(dump_only) != 0) {

View file

@ -248,9 +248,7 @@ hotkeys_done();
/* color of locked item */ /* color of locked item */
extern gchar locked_color_str[32]; extern gchar locked_color_str[32];
extern GdkColor locked_color; extern GdkRGBA locked_color;
extern GtkStyle *style_locked,
*style_normal;
extern gint submenu_count; extern gint submenu_count;
/* /*