From e62413c54f47a4ab146a40b60795cf414ab3a6e7 Mon Sep 17 00:00:00 2001 From: Skunnyk Date: Tue, 3 May 2016 14:35:40 +0200 Subject: [PATCH 01/16] [gtk3] Bump dependencies to check for libxfce4ui-2/libxfce4panel-2.0 --- configure.ac.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac.in b/configure.ac.in index 7773fa3..ef80357 100644 --- a/configure.ac.in +++ b/configure.ac.in @@ -58,10 +58,10 @@ AC_CHECK_LIB(nsl, kstat_open, SOLLIBS="$SOLLIBS -linet_ntop", SOLLIBS="$SOLLIBS" AC_SUBST(SOLLIBS) dnl configure the panel plugin -XDT_CHECK_PACKAGE([LIBXFCE4PANEL], [libxfce4panel-1.0], [4.9.0]) +XDT_CHECK_PACKAGE([LIBXFCE4PANEL], [libxfce4panel-2.0], [4.12.0]) dnl configure the libxfcegui4 -XDT_CHECK_PACKAGE([LIBXFCE4UI], [libxfce4ui-1], [4.9.0]) +XDT_CHECK_PACKAGE([LIBXFCE4UI], [libxfce4ui-2], [4.12.0]) dnl Check for i18n support XDT_I18N([@LINGUAS@]) From f82dde4b2e1a66445736d1730598d71e8b33bbee Mon Sep 17 00:00:00 2001 From: Skunnyk Date: Tue, 3 May 2016 14:36:16 +0200 Subject: [PATCH 02/16] Set X-XFCE-API=2.0 in desktop file --- panel-plugin/netload.desktop.in.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/panel-plugin/netload.desktop.in.in b/panel-plugin/netload.desktop.in.in index 3a461f2..d4918cb 100644 --- a/panel-plugin/netload.desktop.in.in +++ b/panel-plugin/netload.desktop.in.in @@ -6,4 +6,4 @@ _Comment=Show network traffic Icon=xfce4-netload-plugin X-XFCE-Module=netload X-XFCE-Internal=FALSE - +X-XFCE-API=2.0 From a7d0f57e01d95b646c4cba39a2985fa859c22f9b Mon Sep 17 00:00:00 2001 From: Skunnyk Date: Tue, 3 May 2016 14:42:20 +0200 Subject: [PATCH 03/16] Use GtkOrientable instead of *_set_orientation --- panel-plugin/netload.c | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/panel-plugin/netload.c b/panel-plugin/netload.c index e23ccc1..8eadb60 100644 --- a/panel-plugin/netload.c +++ b/panel-plugin/netload.c @@ -340,45 +340,49 @@ static void monitor_set_mode (XfcePanelPlugin *plugin, XfcePanelPluginMode mode, if (mode == XFCE_PANEL_PLUGIN_MODE_DESKBAR) { - xfce_hvbox_set_orientation(XFCE_HVBOX(global->box), GTK_ORIENTATION_VERTICAL); - xfce_hvbox_set_orientation(XFCE_HVBOX(global->box_bars), GTK_ORIENTATION_VERTICAL); + gtk_orientable_set_orientation(GTK_ORIENTABLE(global->box), GTK_ORIENTATION_VERTICAL); + gtk_orientable_set_orientation(GTK_ORIENTABLE(global->box_bars), GTK_ORIENTATION_VERTICAL); gtk_label_set_angle(GTK_LABEL(global->monitor->label), 0); - gtk_misc_set_alignment(GTK_MISC(global->monitor->rcv_label), 0.5f, 1.0f); - gtk_misc_set_alignment(GTK_MISC(global->monitor->sent_label), 0.5f, 0.0f); + gtk_widget_set_halign(global->monitor->rcv_label,GTK_ALIGN_CENTER); + gtk_widget_set_valign(global->monitor->rcv_label,GTK_ALIGN_END); + gtk_widget_set_halign(global->monitor->sent_label,GTK_ALIGN_CENTER); + gtk_widget_set_valign(global->monitor->sent_label,GTK_ALIGN_START); gtk_label_set_angle(GTK_LABEL(global->monitor->rcv_label), 0); gtk_label_set_angle(GTK_LABEL(global->monitor->sent_label), 0); for (i = 0; i < SUM; i++) - gtk_progress_bar_set_orientation(GTK_PROGRESS_BAR(global->monitor->status[i]), - GTK_PROGRESS_LEFT_TO_RIGHT); + gtk_orientable_set_orientation(GTK_ORIENTABLE(global->monitor->status[i]),GTK_ORIENTATION_HORIZONTAL); } else if (mode == XFCE_PANEL_PLUGIN_MODE_VERTICAL) { - xfce_hvbox_set_orientation(XFCE_HVBOX(global->box), GTK_ORIENTATION_VERTICAL); - xfce_hvbox_set_orientation(XFCE_HVBOX(global->box_bars), GTK_ORIENTATION_VERTICAL); + gtk_orientable_set_orientation(GTK_ORIENTABLE(global->box), GTK_ORIENTATION_VERTICAL); + gtk_orientable_set_orientation(GTK_ORIENTABLE(global->box_bars), GTK_ORIENTATION_VERTICAL); gtk_label_set_angle(GTK_LABEL(global->monitor->label), 270); - gtk_misc_set_alignment(GTK_MISC(global->monitor->rcv_label), 0.5f, 1.0f); - gtk_misc_set_alignment(GTK_MISC(global->monitor->sent_label), 0.5f, 0.0f); + gtk_widget_set_halign(global->monitor->rcv_label,GTK_ALIGN_CENTER); + gtk_widget_set_valign(global->monitor->rcv_label,GTK_ALIGN_END); + gtk_widget_set_halign(global->monitor->sent_label,GTK_ALIGN_CENTER); + gtk_widget_set_valign(global->monitor->sent_label,GTK_ALIGN_START); gtk_label_set_angle(GTK_LABEL(global->monitor->rcv_label), 270); gtk_label_set_angle(GTK_LABEL(global->monitor->sent_label), 270); for (i = 0; i < SUM; i++) { - gtk_progress_bar_set_orientation(GTK_PROGRESS_BAR(global->monitor->status[i]), - GTK_PROGRESS_LEFT_TO_RIGHT); + gtk_orientable_set_orientation(GTK_ORIENTABLE(global->monitor->status[i]),GTK_ORIENTATION_HORIZONTAL); } } else /* mode == XFCE_PANEL_PLUGIN_MODE_HORIZONTAL */ { - xfce_hvbox_set_orientation(XFCE_HVBOX(global->box), GTK_ORIENTATION_HORIZONTAL); - xfce_hvbox_set_orientation(XFCE_HVBOX(global->box_bars), GTK_ORIENTATION_HORIZONTAL); + gtk_orientable_set_orientation(GTK_ORIENTABLE(global->box), GTK_ORIENTATION_HORIZONTAL); + gtk_orientable_set_orientation(GTK_ORIENTABLE(global->box_bars), GTK_ORIENTATION_HORIZONTAL); gtk_label_set_angle(GTK_LABEL(global->monitor->label), 0); - gtk_misc_set_alignment(GTK_MISC(global->monitor->rcv_label), 1.0f, 0.5f); - gtk_misc_set_alignment(GTK_MISC(global->monitor->sent_label), 0.0f, 0.5f); + gtk_widget_set_halign(global->monitor->rcv_label,GTK_ALIGN_END); + gtk_widget_set_valign(global->monitor->rcv_label,GTK_ALIGN_CENTER); + gtk_widget_set_halign(global->monitor->rcv_label,GTK_ALIGN_START); + gtk_widget_set_valign(global->monitor->rcv_label,GTK_ALIGN_CENTER); gtk_label_set_angle(GTK_LABEL(global->monitor->rcv_label), 0); gtk_label_set_angle(GTK_LABEL(global->monitor->sent_label), 0); for (i = 0; i < SUM; i++) { - gtk_progress_bar_set_orientation(GTK_PROGRESS_BAR(global->monitor->status[i]), - GTK_PROGRESS_BOTTOM_TO_TOP); + gtk_orientable_set_orientation(GTK_ORIENTABLE(global->monitor->status[i]),GTK_ORIENTATION_VERTICAL); + gtk_progress_bar_set_inverted(GTK_PROGRESS_BAR(global->monitor->status[i]),TRUE); } } From 85a23bcf2c2eaa5d7daeded4577f7cbcfa995d7e Mon Sep 17 00:00:00 2001 From: Skunnyk Date: Tue, 3 May 2016 14:45:07 +0200 Subject: [PATCH 04/16] Use GtkBox instead of XfceHVBox --- panel-plugin/netload.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/panel-plugin/netload.c b/panel-plugin/netload.c index 8eadb60..02c279d 100644 --- a/panel-plugin/netload.c +++ b/panel-plugin/netload.c @@ -466,7 +466,7 @@ static t_global_monitor * monitor_new(XfcePanelPlugin *plugin) } /* Create widget containers */ - global->box = xfce_hvbox_new(GTK_ORIENTATION_HORIZONTAL, FALSE, 0); + global->box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); gtk_container_set_border_width(GTK_CONTAINER(global->box), 2); gtk_widget_show(GTK_WIDGET(global->box)); @@ -488,7 +488,7 @@ static t_global_monitor * monitor_new(XfcePanelPlugin *plugin) gtk_event_box_set_visible_window(GTK_EVENT_BOX(global->ebox_bars), FALSE); gtk_event_box_set_above_child(GTK_EVENT_BOX(global->ebox_bars), TRUE); gtk_widget_show(global->ebox_bars); - global->box_bars = xfce_hvbox_new(GTK_ORIENTATION_HORIZONTAL, FALSE, 0); + global->box_bars = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); gtk_widget_show(global->box_bars); for (i = 0; i < SUM; i++) { From 59975fa3971031d2eb62278c6a4ed309e5942256 Mon Sep 17 00:00:00 2001 From: Skunnyk Date: Tue, 3 May 2016 14:49:04 +0200 Subject: [PATCH 05/16] Use GdkRGBA instead of GdkColor --- panel-plugin/netload.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/panel-plugin/netload.c b/panel-plugin/netload.c index 02c279d..c0f888a 100644 --- a/panel-plugin/netload.c +++ b/panel-plugin/netload.c @@ -77,7 +77,7 @@ typedef struct gboolean auto_max; gulong max[SUM]; gint update_interval; - GdkColor color[SUM]; + GdkRGBA color[SUM]; gchar *label_text; gchar *network_device; gchar *old_network_device; @@ -453,7 +453,7 @@ static t_global_monitor * monitor_new(XfcePanelPlugin *plugin) for (i = 0; i < SUM; i++) { - gdk_color_parse(DEFAULT_COLOR[i], &global->monitor->options.color[i]); + gdk_rgba_parse(&global->monitor->options.color[i], DEFAULT_COLOR[i]); global->monitor->history[i][0] = 0; global->monitor->history[i][1] = 0; @@ -631,13 +631,11 @@ static void monitor_read_config(XfcePanelPlugin *plugin, t_global_monitor *globa if ((value = xfce_rc_read_entry (rc, "Color_In", NULL)) != NULL) { - gdk_color_parse(value, - &global->monitor->options.color[IN]); + gdk_rgba_parse(&global->monitor->options.color[IN], value); } if ((value = xfce_rc_read_entry (rc, "Color_Out", NULL)) != NULL) { - gdk_color_parse(value, - &global->monitor->options.color[OUT]); + gdk_rgba_parse(&global->monitor->options.color[OUT], value); } if ((value = xfce_rc_read_entry (rc, "Text", NULL)) && *value) { From 188d11125c64b2cc50045251ee03ddbfec08580e Mon Sep 17 00:00:00 2001 From: Skunnyk Date: Tue, 3 May 2016 16:04:31 +0200 Subject: [PATCH 06/16] Use cairo for drawing Need more works. --- panel-plugin/netload.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/panel-plugin/netload.c b/panel-plugin/netload.c index c0f888a..49dcdee 100644 --- a/panel-plugin/netload.c +++ b/panel-plugin/netload.c @@ -889,17 +889,12 @@ static void colorize_values_toggled(GtkWidget *check_button, t_global_monitor *g /* ---------------------------------------------------------------------------------------------- */ static gboolean expose_event_cb(GtkWidget *widget, GdkEventExpose *event) { - if (widget->window) + if (gtk_widget_get_window(widget)) { - GtkStyle *style; - - style = gtk_widget_get_style(widget); - - gdk_draw_rectangle(widget->window, - style->bg_gc[GTK_STATE_NORMAL], - TRUE, - event->area.x, event->area.y, - event->area.width, event->area.height); + cairo_t *cr; + cr = gdk_cairo_create (gtk_widget_get_window(widget)); + cairo_rectangle (cr, event->area.x, event->area.y, event->area.width, event->area.height); + cairo_fill (cr); } return TRUE; From 09c4ce577e6648585d4aaa8a9661ff7aa4743b3e Mon Sep 17 00:00:00 2001 From: Skunnyk Date: Tue, 3 May 2016 16:07:26 +0200 Subject: [PATCH 07/16] Remove GTK_DIALOG_NO_SEPARATOR usage, use 'gtk-close' --- panel-plugin/netload.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/panel-plugin/netload.c b/panel-plugin/netload.c index 49dcdee..003d85f 100644 --- a/panel-plugin/netload.c +++ b/panel-plugin/netload.c @@ -986,8 +986,8 @@ static void monitor_create_options(XfcePanelPlugin *plugin, t_global_monitor *gl xfce_panel_plugin_block_menu (plugin); dlg = xfce_titled_dialog_new_with_buttons (_("Network Monitor"), NULL, - GTK_DIALOG_NO_SEPARATOR, - GTK_STOCK_CLOSE, GTK_RESPONSE_OK, + GTK_DIALOG_DESTROY_WITH_PARENT, + "gtk-close", GTK_RESPONSE_OK, NULL); gtk_window_set_icon_name (GTK_WINDOW (dlg), "xfce4-settings"); From 1cf0f5f68f5551448b4da99e905627bd2f85fe5d Mon Sep 17 00:00:00 2001 From: Skunnyk Date: Tue, 3 May 2016 16:12:01 +0200 Subject: [PATCH 08/16] Use GtkBox instead of XfceHVBox/GtkHBox/GtkVBox --- panel-plugin/netload.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/panel-plugin/netload.c b/panel-plugin/netload.c index 003d85f..49bb5ad 100644 --- a/panel-plugin/netload.c +++ b/panel-plugin/netload.c @@ -996,21 +996,21 @@ static void monitor_create_options(XfcePanelPlugin *plugin, t_global_monitor *gl global->opt_dialog = dlg; - global_vbox = GTK_BOX (gtk_vbox_new(FALSE, BORDER)); + global_vbox = GTK_BOX (gtk_box_new(GTK_ORIENTATION_VERTICAL, BORDER)); gtk_container_set_border_width (GTK_CONTAINER (global_vbox), BORDER - 2); gtk_widget_show(GTK_WIDGET (global_vbox)); - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), GTK_WIDGET (global_vbox), TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX (gtk_dialog_get_content_area(GTK_DIALOG(dlg))), GTK_WIDGET (global_vbox), TRUE, TRUE, 0); sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); - vbox = GTK_BOX(gtk_vbox_new(FALSE, 5)); + vbox = GTK_BOX(gtk_box_new(GTK_ORIENTATION_VERTICAL, 5)); gtk_widget_show(GTK_WIDGET(vbox)); - global->monitor->opt_vbox = GTK_BOX(gtk_vbox_new(FALSE, 5)); + global->monitor->opt_vbox = GTK_BOX(gtk_box_new(GTK_ORIENTATION_VERTICAL, 5)); gtk_widget_show(GTK_WIDGET(global->monitor->opt_vbox)); /* Displayed text */ - global->monitor->opt_hbox = GTK_BOX(gtk_hbox_new(FALSE, 5)); + global->monitor->opt_hbox = GTK_BOX(gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5)); gtk_widget_show(GTK_WIDGET(global->monitor->opt_hbox)); global->monitor->opt_use_label = @@ -1041,7 +1041,7 @@ static void monitor_create_options(XfcePanelPlugin *plugin, t_global_monitor *gl global->monitor->options.use_label); /* Network device */ - net_hbox = GTK_BOX(gtk_hbox_new(FALSE, 5)); + net_hbox = GTK_BOX(gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5)); gtk_box_pack_start(GTK_BOX(global->monitor->opt_vbox), GTK_WIDGET(net_hbox), FALSE, FALSE, 0); @@ -1093,7 +1093,7 @@ static void monitor_create_options(XfcePanelPlugin *plugin, t_global_monitor *gl gtk_size_group_add_widget(sg, update_label); /* Show values as bits */ - bits_hbox = GTK_BOX(gtk_hbox_new(FALSE, 5)); + bits_hbox = GTK_BOX(gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5)); gtk_widget_show(GTK_WIDGET(bits_hbox)); gtk_box_pack_start(GTK_BOX(global->monitor->opt_vbox), GTK_WIDGET(bits_hbox), FALSE, FALSE, 0); @@ -1124,7 +1124,7 @@ static void monitor_create_options(XfcePanelPlugin *plugin, t_global_monitor *gl /* Input maximum */ for( i = 0; i < SUM; i++) { - global->monitor->max_hbox[i] = GTK_BOX(gtk_hbox_new(FALSE, 5)); + global->monitor->max_hbox[i] = GTK_BOX(gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5)); gtk_box_pack_start(GTK_BOX(global->monitor->opt_vbox), GTK_WIDGET(global->monitor->max_hbox[i]), FALSE, FALSE, 0); @@ -1167,7 +1167,7 @@ static void monitor_create_options(XfcePanelPlugin *plugin, t_global_monitor *gl gtk_widget_show(sep2); /* Show bars and values */ - global->monitor->opt_present_data_hbox = GTK_WIDGET(gtk_hbox_new(FALSE, 5)); + global->monitor->opt_present_data_hbox = GTK_WIDGET(gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5)); gtk_widget_show(global->monitor->opt_present_data_hbox); gtk_box_pack_start(GTK_BOX(global->monitor->opt_vbox), GTK_WIDGET(global->monitor->opt_present_data_hbox), FALSE, FALSE, 0); @@ -1202,7 +1202,7 @@ static void monitor_create_options(XfcePanelPlugin *plugin, t_global_monitor *gl /* Color 1 */ for (i = 0; i < SUM; i++) { - global->monitor->opt_color_hbox[i] = gtk_hbox_new(FALSE, 5); + global->monitor->opt_color_hbox[i] = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5); gtk_widget_show(GTK_WIDGET(global->monitor->opt_color_hbox[i])); gtk_box_pack_start(GTK_BOX(global->monitor->opt_vbox), GTK_WIDGET(global->monitor->opt_color_hbox[i]), FALSE, FALSE, 0); From e93b708843d4c0c223c8bc8e20388c2d715ab347 Mon Sep 17 00:00:00 2001 From: Skunnyk Date: Tue, 3 May 2016 18:23:00 +0200 Subject: [PATCH 09/16] Use gtk_widget_set_halign/valign instead of gtk_misc_set_alignment() --- panel-plugin/netload.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/panel-plugin/netload.c b/panel-plugin/netload.c index 49bb5ad..1ec6868 100644 --- a/panel-plugin/netload.c +++ b/panel-plugin/netload.c @@ -1046,7 +1046,7 @@ static void monitor_create_options(XfcePanelPlugin *plugin, t_global_monitor *gl GTK_WIDGET(net_hbox), FALSE, FALSE, 0); device_label = gtk_label_new_with_mnemonic(_("Network _device:")); - gtk_misc_set_alignment(GTK_MISC(device_label), 0, 0.5); + gtk_widget_set_valign(device_label,GTK_ALIGN_CENTER); gtk_widget_show(GTK_WIDGET(device_label)); gtk_box_pack_start(GTK_BOX(net_hbox), GTK_WIDGET(device_label), FALSE, FALSE, 0); @@ -1073,7 +1073,7 @@ static void monitor_create_options(XfcePanelPlugin *plugin, t_global_monitor *gl GTK_WIDGET(update_hbox), FALSE, FALSE, 0); update_label = gtk_label_new_with_mnemonic(_("Update _interval:")); - gtk_misc_set_alignment(GTK_MISC(update_label), 0, 0.5); + gtk_widget_set_valign(update_label, GTK_ALIGN_CENTER); gtk_box_pack_start(GTK_BOX(update_hbox), GTK_WIDGET(update_label), FALSE, FALSE, 0); global->monitor->update_spinner = gtk_spin_button_new_with_range (0.1, 10.0, 0.05); @@ -1129,7 +1129,7 @@ static void monitor_create_options(XfcePanelPlugin *plugin, t_global_monitor *gl GTK_WIDGET(global->monitor->max_hbox[i]), FALSE, FALSE, 0); max_label[i] = gtk_label_new_with_mnemonic(_(maximum_text_label[i])); - gtk_misc_set_alignment(GTK_MISC(max_label[i]), 0, 0.5); + gtk_widget_set_valign(max_label[i], GTK_ALIGN_CENTER); gtk_widget_show(GTK_WIDGET(max_label[i])); gtk_box_pack_start(GTK_BOX(global->monitor->max_hbox[i]), GTK_WIDGET(max_label[i]), FALSE, FALSE, 0); @@ -1173,7 +1173,7 @@ static void monitor_create_options(XfcePanelPlugin *plugin, t_global_monitor *gl GTK_WIDGET(global->monitor->opt_present_data_hbox), FALSE, FALSE, 0); global->monitor->opt_present_data_label = gtk_label_new_with_mnemonic(_("_Present data as:")); - gtk_misc_set_alignment(GTK_MISC(global->monitor->opt_present_data_label), 0, 0.5); + gtk_widget_set_valign(global->monitor->opt_present_data_label, GTK_ALIGN_CENTER); gtk_widget_show(global->monitor->opt_present_data_label); gtk_box_pack_start(GTK_BOX(global->monitor->opt_present_data_hbox), global->monitor->opt_present_data_label, FALSE, FALSE, 0); @@ -1208,7 +1208,7 @@ static void monitor_create_options(XfcePanelPlugin *plugin, t_global_monitor *gl GTK_WIDGET(global->monitor->opt_color_hbox[i]), FALSE, FALSE, 0); color_label[i] = gtk_label_new_with_mnemonic(_(color_text[i])); - gtk_misc_set_alignment(GTK_MISC(color_label[i]), 0, 0.5); + gtk_widget_set_valign(color_label[i], GTK_ALIGN_CENTER); gtk_widget_show(GTK_WIDGET(color_label[i])); gtk_box_pack_start(GTK_BOX(global->monitor->opt_color_hbox[i]), GTK_WIDGET(color_label[i]), FALSE, FALSE, 0); From a80e39b286faa301b41a92013b4ba04a5057b48b Mon Sep 17 00:00:00 2001 From: Skunnyk Date: Tue, 3 May 2016 18:24:27 +0200 Subject: [PATCH 10/16] Use gtk_separator_new instead of gtk_hseparator_new --- panel-plugin/netload.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/panel-plugin/netload.c b/panel-plugin/netload.c index 1ec6868..6c75e6e 100644 --- a/panel-plugin/netload.c +++ b/panel-plugin/netload.c @@ -1108,7 +1108,7 @@ static void monitor_create_options(XfcePanelPlugin *plugin, t_global_monitor *gl global->monitor->options.values_as_bits); - sep1 = gtk_hseparator_new(); + sep1 = gtk_separator_new(GTK_ORIENTATION_HORIZONTAL); gtk_box_pack_start(GTK_BOX(global->monitor->opt_vbox), GTK_WIDGET(sep1), FALSE, FALSE, 0); gtk_widget_show(sep1); @@ -1162,7 +1162,7 @@ static void monitor_create_options(XfcePanelPlugin *plugin, t_global_monitor *gl } - sep2 = gtk_hseparator_new(); + sep2 = gtk_separator_new(GTK_ORIENTATION_HORIZONTAL); gtk_box_pack_start(GTK_BOX(global->monitor->opt_vbox), GTK_WIDGET(sep2), FALSE, FALSE, 0); gtk_widget_show(sep2); From 880cfa14121386e8cf5503546280ad6ecce91b45 Mon Sep 17 00:00:00 2001 From: Skunnyk Date: Tue, 3 May 2016 18:25:30 +0200 Subject: [PATCH 11/16] Migrate to gtk_combo_box_text_append_text --- panel-plugin/netload.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/panel-plugin/netload.c b/panel-plugin/netload.c index 6c75e6e..666f429 100644 --- a/panel-plugin/netload.c +++ b/panel-plugin/netload.c @@ -1181,9 +1181,9 @@ static void monitor_create_options(XfcePanelPlugin *plugin, t_global_monitor *gl global->monitor->opt_present_data_combobox = gtk_combo_box_new_text(); gtk_label_set_mnemonic_widget(GTK_LABEL(global->monitor->opt_present_data_label), global->monitor->opt_present_data_combobox); - gtk_combo_box_append_text(GTK_COMBO_BOX(global->monitor->opt_present_data_combobox), _("Bars")); - gtk_combo_box_append_text(GTK_COMBO_BOX(global->monitor->opt_present_data_combobox), _("Values")); - gtk_combo_box_append_text(GTK_COMBO_BOX(global->monitor->opt_present_data_combobox), _("Bars and values")); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(global->monitor->opt_present_data_combobox), _("Bars")); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(global->monitor->opt_present_data_combobox), _("Values")); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(global->monitor->opt_present_data_combobox), _("Bars and values")); if(global->monitor->options.show_values) if(global->monitor->options.show_bars) From c3683dbaeaf81db4ef7c0ad99360425bd7535508 Mon Sep 17 00:00:00 2001 From: Skunnyk Date: Tue, 3 May 2016 18:26:40 +0200 Subject: [PATCH 12/16] Stop using GtkAligment, directly set halign/valign --- panel-plugin/netload.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/panel-plugin/netload.c b/panel-plugin/netload.c index 666f429..2a107da 100644 --- a/panel-plugin/netload.c +++ b/panel-plugin/netload.c @@ -969,7 +969,6 @@ static void monitor_create_options(XfcePanelPlugin *plugin, t_global_monitor *gl GtkBox *update_hbox; GtkWidget *update_label, *update_unit_label; GtkWidget *color_label[SUM]; - GtkWidget *align; gint present_data_active; GtkSizeGroup *sg; gint i; @@ -1246,10 +1245,8 @@ static void monitor_create_options(XfcePanelPlugin *plugin, t_global_monitor *gl GTK_WIDGET(global->monitor->opt_vbox), FALSE, FALSE, 0); - align = gtk_alignment_new(0, 0, 0, 0); - gtk_widget_set_size_request(align, 5, 5); - gtk_widget_show(GTK_WIDGET(align)); - gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(align), FALSE, FALSE, 0); + gtk_widget_set_halign(GTK_WIDGET(vbox), GTK_ALIGN_START); + gtk_widget_set_valign(GTK_WIDGET(vbox), GTK_ALIGN_START); gtk_box_pack_start( GTK_BOX(global_vbox), GTK_WIDGET(vbox), FALSE, FALSE, 0); From 7ffcfc6fa8b4a1a789426893eb330dc34fb41b26 Mon Sep 17 00:00:00 2001 From: Skunnyk Date: Tue, 3 May 2016 18:29:12 +0200 Subject: [PATCH 13/16] Migrate GtkFunction to GSourceFunc --- panel-plugin/netload.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/panel-plugin/netload.c b/panel-plugin/netload.c index 2a107da..bda0ad8 100644 --- a/panel-plugin/netload.c +++ b/panel-plugin/netload.c @@ -285,7 +285,7 @@ static void run_update (t_global_monitor *global) if (global->monitor->options.update_interval > 0) { global->timeout_id = g_timeout_add( global->monitor->options.update_interval, - (GtkFunction)update_monitors, global); + (GSourceFunc)update_monitors, global); } } From 31f12e508dc7385f3e4144372b8adbb178bb73ee Mon Sep 17 00:00:00 2001 From: Skunnyk Date: Tue, 3 May 2016 18:29:53 +0200 Subject: [PATCH 14/16] Use gtk_combo_box_new_text --- panel-plugin/netload.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/panel-plugin/netload.c b/panel-plugin/netload.c index bda0ad8..ae54ea3 100644 --- a/panel-plugin/netload.c +++ b/panel-plugin/netload.c @@ -1177,7 +1177,7 @@ static void monitor_create_options(XfcePanelPlugin *plugin, t_global_monitor *gl gtk_box_pack_start(GTK_BOX(global->monitor->opt_present_data_hbox), global->monitor->opt_present_data_label, FALSE, FALSE, 0); - global->monitor->opt_present_data_combobox = gtk_combo_box_new_text(); + global->monitor->opt_present_data_combobox = gtk_combo_box_text_new(); gtk_label_set_mnemonic_widget(GTK_LABEL(global->monitor->opt_present_data_label), global->monitor->opt_present_data_combobox); gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(global->monitor->opt_present_data_combobox), _("Bars")); From 47df48814fd3de55609765225228138e568c48c7 Mon Sep 17 00:00:00 2001 From: Skunnyk Date: Tue, 3 May 2016 18:32:01 +0200 Subject: [PATCH 15/16] Disable colorsel for now to allow build with gtk3 Need to migrate to GtkColorChooser Lot of deprecated warning, need to migrate to GtkStyle --- panel-plugin/netload.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/panel-plugin/netload.c b/panel-plugin/netload.c index ae54ea3..89544e2 100644 --- a/panel-plugin/netload.c +++ b/panel-plugin/netload.c @@ -911,8 +911,9 @@ static void change_color(GtkWidget *button, t_global_monitor *global, gint type) dialog = gtk_color_selection_dialog_new(_("Select color")); gtk_window_set_transient_for(GTK_WINDOW(dialog), GTK_WINDOW(global->opt_dialog)); - colorsel = - GTK_COLOR_SELECTION(GTK_COLOR_SELECTION_DIALOG(dialog)->colorsel); + // Fixme for GTK3 Migration + //colorsel = + // GTK_COLOR_SELECTION(GTK_COLOR_SELECTION_DIALOG(dialog)->colorsel); gtk_color_selection_set_previous_color(colorsel, &global->monitor->options.color[type]); gtk_color_selection_set_current_color(colorsel, From 58501561aa38df852787d7708581dd12352e8d76 Mon Sep 17 00:00:00 2001 From: Skunnyk Date: Wed, 11 May 2016 22:41:26 +0200 Subject: [PATCH 16/16] First try to migrate to GtkColorChooser --- panel-plugin/netload.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/panel-plugin/netload.c b/panel-plugin/netload.c index 89544e2..4d4c476 100644 --- a/panel-plugin/netload.c +++ b/panel-plugin/netload.c @@ -542,9 +542,9 @@ static void setup_monitor(t_global_monitor *global, gboolean supress_warnings) if (global->monitor->options.colorize_values) { - gtk_widget_modify_fg(global->monitor->rcv_label, GTK_STATE_NORMAL, + gtk_widget_override_color(global->monitor->rcv_label, GTK_STATE_NORMAL, &global->monitor->options.color[IN]); - gtk_widget_modify_fg(global->monitor->sent_label, GTK_STATE_NORMAL, + gtk_widget_override_color(global->monitor->sent_label, GTK_STATE_NORMAL, &global->monitor->options.color[OUT]); } else @@ -900,31 +900,30 @@ static gboolean expose_event_cb(GtkWidget *widget, GdkEventExpose *event) return TRUE; } - /* ---------------------------------------------------------------------------------------------- */ static void change_color(GtkWidget *button, t_global_monitor *global, gint type) { GtkWidget *dialog; - GtkColorSelection *colorsel; + GdkRGBA colorsel; gint response; - dialog = gtk_color_selection_dialog_new(_("Select color")); + dialog = gtk_color_chooser_dialog_new(_("Select color"), GTK_WINDOW(global->opt_dialog)); gtk_window_set_transient_for(GTK_WINDOW(dialog), GTK_WINDOW(global->opt_dialog)); // Fixme for GTK3 Migration //colorsel = // GTK_COLOR_SELECTION(GTK_COLOR_SELECTION_DIALOG(dialog)->colorsel); - gtk_color_selection_set_previous_color(colorsel, - &global->monitor->options.color[type]); - gtk_color_selection_set_current_color(colorsel, - &global->monitor->options.color[type]); - gtk_color_selection_set_has_palette(colorsel, TRUE); + //gtk_color_selection_set_previous_color(colorsel, + // &global->monitor->options.color[type]); + //gtk_color_selection_set_current_color(colorsel, + // &global->monitor->options.color[type]); + //gtk_color_selection_set_has_palette(colorsel, TRUE); + //gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER (dialog), &global->monitor->options.color[type]); response = gtk_dialog_run(GTK_DIALOG(dialog)); if (response == GTK_RESPONSE_OK) { - gtk_color_selection_get_current_color(colorsel, - &global->monitor->options.color[type]); + gtk_color_chooser_get_rgba(GTK_COLOR_CHOOSER (dialog), &global->monitor->options.color[type]); gtk_widget_modify_bg(global->monitor->opt_da[type], GTK_STATE_NORMAL, &global->monitor->options.color[type]);