diff options
author | Alberts Muktupāvels <[email protected]> | 2020-03-10 14:36:47 +0200 |
---|---|---|
committer | Robert Antoni Buj Gelonch <[email protected]> | 2020-08-01 23:08:45 +0200 |
commit | 274282dacff8b22d03ca1be1c72c5d64f7b956a0 (patch) | |
tree | 0df7738354c6ce8b951033e73223f1ebb836c70f | |
parent | 3b8e2111a4484c8450297d6764d1e3c30b3327c8 (diff) | |
download | mate-applets-274282dacff8b22d03ca1be1c72c5d64f7b956a0.tar.bz2 mate-applets-274282dacff8b22d03ca1be1c72c5d64f7b956a0.tar.xz |
cpufreq: avoid deprecated GtkAlignment
origin commit:
https://gitlab.gnome.org/GNOME/gnome-applets/-/commit/66e58e7
-rw-r--r-- | cpufreq/src/cpufreq-applet.c | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/cpufreq/src/cpufreq-applet.c b/cpufreq/src/cpufreq-applet.c index 10671882..4be70ba9 100644 --- a/cpufreq/src/cpufreq-applet.c +++ b/cpufreq/src/cpufreq-applet.c @@ -56,7 +56,6 @@ struct _CPUFreqApplet { MatePanelAppletOrient orient; gint size; - GtkWidget *container; GtkWidget *box; GtkWidget *icon; GtkWidget *labels_box; @@ -184,24 +183,22 @@ cpufreq_applet_init (CPUFreqApplet *applet) applet->size = mate_panel_applet_get_size (MATE_PANEL_APPLET (applet)); applet->orient = mate_panel_applet_get_orient (MATE_PANEL_APPLET (applet)); + applet->box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2); + gtk_container_add (GTK_CONTAINER (applet), applet->box); + gtk_widget_set_valign (applet->box, GTK_ALIGN_CENTER); + gtk_widget_show (applet->box); + switch (applet->orient) { case MATE_PANEL_APPLET_ORIENT_LEFT: case MATE_PANEL_APPLET_ORIENT_RIGHT: - applet->container = gtk_alignment_new (0.5, 0.5, 0, 0); + gtk_widget_set_halign (applet->box, GTK_ALIGN_CENTER); break; case MATE_PANEL_APPLET_ORIENT_UP: case MATE_PANEL_APPLET_ORIENT_DOWN: - applet->container = gtk_alignment_new (0, 0.5, 0, 0); + gtk_widget_set_halign (applet->box, GTK_ALIGN_START); break; } - gtk_container_add (GTK_CONTAINER (applet), applet->container); - gtk_widget_show (applet->container); - - applet->box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2); - gtk_container_add (GTK_CONTAINER (applet->container), applet->box); - gtk_widget_show (applet->box); - applet->icon = gtk_image_new (); gtk_box_pack_start (GTK_BOX (applet->box), applet->icon, FALSE, FALSE, 0); @@ -401,12 +398,10 @@ cpufreq_applet_change_orient (MatePanelApplet *pa, (orient == MATE_PANEL_APPLET_ORIENT_RIGHT)) { size = allocation.width; - gtk_alignment_set (GTK_ALIGNMENT (applet->container), - 0.5, 0.5, 0, 0); + gtk_widget_set_halign (applet->box, GTK_ALIGN_CENTER); } else { size = allocation.height; - gtk_alignment_set (GTK_ALIGNMENT (applet->container), - 0, 0.5, 0, 0); + gtk_widget_set_halign (applet->box, GTK_ALIGN_START); } if (size != applet->size) { |