commit systemd-ui for openSUSE:Factory
Hello community, here is the log from the commit of package systemd-ui for openSUSE:Factory checked in at 2012-12-10 17:21:40 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/systemd-ui (Old) and /work/SRC/openSUSE:Factory/.systemd-ui.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "systemd-ui", Maintainer is "" Changes: -------- --- /work/SRC/openSUSE:Factory/systemd-ui/systemd-ui.changes 2012-11-02 17:43:19.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.systemd-ui.new/systemd-ui.changes 2012-12-10 17:21:42.000000000 +0100 @@ -1,0 +2,8 @@ +Fri Nov 30 10:12:04 UTC 2012 - fcrozat@suse.com + +- Add build-gee08.patch: allow to build with libgee 0.8 if + installed. +- Add port-gtk3.patch: build with gtk3. +- Add automake/autoconf to BuildRequires and switch to gtk3. + +------------------------------------------------------------------- New: ---- build-gee08.patch port-gtk3.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ systemd-ui.spec ++++++ --- /var/tmp/diff_new_pack.4z48MP/_old 2012-12-10 17:21:43.000000000 +0100 +++ /var/tmp/diff_new_pack.4z48MP/_new 2012-12-10 17:21:43.000000000 +0100 @@ -21,13 +21,15 @@ Version: 1 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build +BuildRequires: autoconf +BuildRequires: automake BuildRequires: vala-devel BuildRequires: xz BuildRequires: pkgconfig(dbus-1) >= 1.3.2 BuildRequires: pkgconfig(gee-1.0) BuildRequires: pkgconfig(gio-unix-2.0) BuildRequires: pkgconfig(glib-2.0) > 2.26 -BuildRequires: pkgconfig(gtk+-2.0) +BuildRequires: pkgconfig(gtk+-3.0) BuildRequires: pkgconfig(libnotify) Summary: Graphical front-end for systemd License: GPL-2.0+ @@ -43,6 +45,10 @@ # an exception will be silently removed with the next version update. # PATCH-FIX-UPSTREAM fix-desktop.patch fcrozat@suse.com -- Fix missing categories and GenericName Patch0: fix-desktop.patch +# PATCH-FIX-UPSTREAM build-gee08.patch fcrozat@suse.com -- Build with libgee 0.8 if present +Patch1: build-gee08.patch +# PATCH-FIX-UPSTREAM port-gtk3.patch fcrozat@suse.com -- Port to GTK3 +Patch2: port-gtk3.patch %description Graphical front-end for systemd system and service manager. @@ -50,8 +56,12 @@ %prep %setup -q %patch0 -p1 +%patch1 -p1 +%patch2 -p1 %build +#needed by patches 1 & 2 +autoreconf export V=1 %configure \ CFLAGS="%{optflags}" ++++++ build-gee08.patch ++++++
From 437fd408ff77c21b5aeceb5a1f9f706b451e730c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?=
Date: Mon, 30 Jul 2012 12:06:12 +0200 Subject: [PATCH 1/2] build-sys: support newer gee version
"Libgee version numbers are a little confusing. In libgee 0.5 and 0.6, the package name was gee-1.0, identified by a file gee-1.0.pc. In libgee 0.7, the package name changed to gee-0.8 (since the library changed incompatibly)." Since systemadm seems to work fine with newer libgee (found in Fedora 17), let's check for both versions, starting with the newer one. Between 1.0 and 0.8 there seems to have been 0.7, but since I don't have one at hand, I'm not adding a check for it. If necessary, configure.ac can be extended to check for that version too. --- Makefile.am | 6 ++++-- configure.ac | 13 ++++++++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/Makefile.am b/Makefile.am index c316901..212b398 100644 --- a/Makefile.am +++ b/Makefile.am @@ -41,6 +41,7 @@ systemadm_SOURCES = \ systemadm_CFLAGS = \ $(AM_CFLAGS) \ $(GTK_CFLAGS) \ + $(GEE_CFLAGS) \ -Wno-unused-variable \ -Wno-unused-function \ -Wno-shadow \ @@ -49,11 +50,12 @@ systemadm_CFLAGS = \ systemadm_VALAFLAGS = \ --pkg=posix \ --pkg=gtk+-2.0 \ - --pkg=gee-1.0 \ + --pkg=$(GEE_PACKAGE) \ -g systemadm_LDADD = \ - $(GTK_LIBS) + $(GTK_LIBS) \ + $(GEE_LIBS) desktopdir = $(datadir)/applications desktop_DATA = \ diff --git a/configure.ac b/configure.ac index 20c3bbe..b6b8310 100644 --- a/configure.ac +++ b/configure.ac @@ -95,10 +95,21 @@ PKG_CHECK_MODULES(DBUS, [ dbus-1 >= 1.3.2 ]) AC_SUBST(DBUS_CFLAGS) AC_SUBST(DBUS_LIBS) -PKG_CHECK_MODULES(GTK, [ gtk+-2.0 glib-2.0 > 2.26 gio-unix-2.0 gee-1.0]) +PKG_CHECK_MODULES(GTK, [ gtk+-2.0 glib-2.0 > 2.26 gio-unix-2.0 ]) AC_SUBST(GTK_CFLAGS) AC_SUBST(GTK_LIBS) +PKG_CHECK_MODULES(GEE, [ gee-0.8 ],, + [AC_MSG_WARN([gee-0.8 not found, falling back to older version])]) +AS_IF([test -n "$GEE_LIBS"], + [AC_DEFINE([GEE_PACKAGE], [gee-0.8], [Use gee-0.8])], + [PKG_CHECK_MODULES(GEE, [ gee-1.0 ]) + AC_DEFINE([GEE_PACKAGE], [gee-1.0], [Use gee-1.0 (old)])] +) +AC_SUBST(GEE_CFLAGS) +AC_SUBST(GEE_LIBS) +AC_SUBST(GEE_PACKAGE) + PKG_CHECK_MODULES(LIBNOTIFY, [ libnotify ]) AC_SUBST(LIBNOTIFY_CFLAGS) AC_SUBST(LIBNOTIFY_LIBS) -- 1.7.10.4
From a6d7688a487e90cbcf51d02377adb5d454c27a47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?=
Date: Tue, 31 Jul 2012 17:02:30 +0200 Subject: [PATCH 2/2] build-sys: fix substitution of GEE_PACKAGE variable
There is no need to AC_DEFINE it. --- configure.ac | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index b6b8310..40e6573 100644 --- a/configure.ac +++ b/configure.ac @@ -102,13 +102,12 @@ AC_SUBST(GTK_LIBS) PKG_CHECK_MODULES(GEE, [ gee-0.8 ],, [AC_MSG_WARN([gee-0.8 not found, falling back to older version])]) AS_IF([test -n "$GEE_LIBS"], - [AC_DEFINE([GEE_PACKAGE], [gee-0.8], [Use gee-0.8])], + [AC_SUBST(GEE_PACKAGE, [gee-0.8])], [PKG_CHECK_MODULES(GEE, [ gee-1.0 ]) - AC_DEFINE([GEE_PACKAGE], [gee-1.0], [Use gee-1.0 (old)])] + AC_SUBST(GEE_PACKAGE, [gee-1.0])] ) AC_SUBST(GEE_CFLAGS) AC_SUBST(GEE_LIBS) -AC_SUBST(GEE_PACKAGE) PKG_CHECK_MODULES(LIBNOTIFY, [ libnotify ]) AC_SUBST(LIBNOTIFY_CFLAGS) -- 1.7.10.4 ++++++ port-gtk3.patch ++++++
From a7f32df98d0fb863b43c04e8664d709f701f2001 Mon Sep 17 00:00:00 2001 From: Thomas Hindoe Paaboel Andersen
Date: Sat, 17 Nov 2012 00:34:37 +0100 Subject: [PATCH] Port to Gtk3
Based on basic patch by Marc-Antoine Perennou in bug #41814 * Replaces the gtk2-specific WrapLabel with normal Label. Wrap+resize works reasonably well in gtk3. * Simplifies layout by using Grid instead of Table * Replaces use of various deprecated objects --- Makefile.am | 7 +-- configure.ac | 2 +- src/gnome-ask-password-agent.vala | 5 +- src/systemadm.vala | 117 +++++++++++++++++++------------------ src/wraplabel.vala | 73 ----------------------- 5 files changed, 67 insertions(+), 137 deletions(-) delete mode 100644 src/wraplabel.vala diff --git a/Makefile.am b/Makefile.am index 211f496..be93f08 100644 --- a/Makefile.am +++ b/Makefile.am @@ -35,8 +35,7 @@ bin_PROGRAMS = \ systemadm_SOURCES = \ src/systemadm.vala \ - src/systemd-interfaces.vala \ - src/wraplabel.vala + src/systemd-interfaces.vala systemadm_CFLAGS = \ $(AM_CFLAGS) \ @@ -49,7 +48,7 @@ systemadm_CFLAGS = \ systemadm_VALAFLAGS = \ --pkg=posix \ - --pkg=gtk+-2.0 \ + --pkg=gtk+-3.0 \ --pkg=$(GEE_PACKAGE) \ -g @@ -84,7 +83,7 @@ systemd_gnome_ask_password_agent_CFLAGS = \ systemd_gnome_ask_password_agent_VALAFLAGS = \ --pkg=posix \ - --pkg=gtk+-2.0 \ + --pkg=gtk+-3.0 \ --pkg=linux \ --pkg=gio-unix-2.0 \ --pkg=libnotify \ diff --git a/configure.ac b/configure.ac index 40e6573..45f7051 100644 --- a/configure.ac +++ b/configure.ac @@ -95,7 +95,7 @@ PKG_CHECK_MODULES(DBUS, [ dbus-1 >= 1.3.2 ]) AC_SUBST(DBUS_CFLAGS) AC_SUBST(DBUS_LIBS) -PKG_CHECK_MODULES(GTK, [ gtk+-2.0 glib-2.0 > 2.26 gio-unix-2.0 ]) +PKG_CHECK_MODULES(GTK, [ gtk+-3.0 glib-2.0 > 2.26 gio-unix-2.0 ]) AC_SUBST(GTK_CFLAGS) AC_SUBST(GTK_LIBS) diff --git a/src/gnome-ask-password-agent.vala b/src/gnome-ask-password-agent.vala index e23aedb..5df27ee 100644 --- a/src/gnome-ask-password-agent.vala +++ b/src/gnome-ask-password-agent.vala @@ -32,7 +32,6 @@ public class PasswordDialog : Dialog { public PasswordDialog(string message, string icon) { set_title("System Password"); - set_has_separator(false); set_border_width(8); set_default_response(ResponseType.OK); set_icon_name(icon); @@ -42,14 +41,14 @@ public class PasswordDialog : Dialog { Container content = (Container) get_content_area(); - Box hbox = new HBox(false, 16); + Box hbox = new Box(Orientation.HORIZONTAL, 16); hbox.set_border_width(8); content.add(hbox); Image image = new Image.from_icon_name(icon, IconSize.DIALOG); hbox.pack_start(image, false, false); - Box vbox = new VBox(false, 8); + Box vbox = new Box(Orientation.VERTICAL, 8); hbox.pack_start(vbox, true, true); Label label = new Label(message); diff --git a/src/systemadm.vala b/src/systemadm.vala index 5971ac0..553633b 100644 --- a/src/systemadm.vala +++ b/src/systemadm.vala @@ -41,16 +41,21 @@ public class LeftLabel : Label { public LeftLabel(string? text = null) { if (text != null) set_markup("<b>%s</b>".printf(text)); - set_alignment(0, 0); - set_padding(6, 0); + halign = Align.START; + valign = Align.START; } } -public class RightLabel : WrapLabel { +public class RightLabel : Label { public RightLabel(string? text = null) { set_selectable(true); set_text_or_na(text); + wrap = true; + wrap_mode = Pango.WrapMode.WORD_CHAR; + halign = Align.START; + valign = Align.START; + hexpand = true; } public void set_text_or_na(string? text = null) { @@ -112,7 +117,7 @@ public class MainWindow : Window { private RightLabel job_state_label; private RightLabel job_type_label; - private ComboBox unit_type_combo_box; + private ComboBoxText unit_type_combo_box; private CheckButton inactive_checkbox; public MainWindow() throws IOError { @@ -125,16 +130,16 @@ public class MainWindow : Window { Notebook notebook = new Notebook(); add(notebook); - Box unit_vbox = new VBox(false, 12); + Box unit_vbox = new Box(Orientation.VERTICAL, 12); notebook.append_page(unit_vbox, new Label("Units")); unit_vbox.set_border_width(12); - Box job_vbox = new VBox(false, 12); + Box job_vbox = new Box(Orientation.VERTICAL, 12); notebook.append_page(job_vbox, new Label("Jobs")); job_vbox.set_border_width(12); - unit_type_combo_box = new ComboBox.text(); - Box type_hbox = new HBox(false, 6); + unit_type_combo_box = new ComboBoxText(); + Box type_hbox = new Box(Orientation.HORIZONTAL, 6); type_hbox.pack_start(unit_type_combo_box, false, false, 0); unit_vbox.pack_start(type_hbox, false, false, 0); @@ -164,7 +169,7 @@ public class MainWindow : Window { unit_load_entry.activate.connect(on_unit_load); unit_load_button.clicked.connect(on_unit_load); - Box unit_load_hbox = new HBox(false, 6); + Box unit_load_hbox = new Box(Orientation.HORIZONTAL, 6); unit_load_hbox.pack_start(unit_load_entry, false, true, 0); unit_load_hbox.pack_start(unit_load_button, false, true, 0); @@ -241,52 +246,52 @@ public class MainWindow : Window { unit_fragment_path_label.set_track_visited_links(false); - Table unit_table = new Table(8, 6, false); - unit_table.set_row_spacings(6); - unit_table.set_border_width(0); - unit_vbox.pack_start(unit_table, false, true, 0); - - Table job_table = new Table(2, 2, false); - job_table.set_row_spacings(6); - job_table.set_border_width(0); - job_vbox.pack_start(job_table, false, true, 0); - - unit_table.attach(new LeftLabel("Id:"), 0, 1, 0, 1, AttachOptions.FILL, AttachOptions.FILL, 0, 0); - unit_table.attach(unit_id_label, 1, 6, 0, 1, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0); - unit_table.attach(new LeftLabel("Description:"), 0, 1, 1, 2, AttachOptions.FILL, AttachOptions.FILL, 0, 0); - unit_table.attach(unit_description_label, 1, 6, 1, 2, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0); - unit_table.attach(new LeftLabel("Dependencies:"), 0, 1, 2, 3, AttachOptions.FILL, AttachOptions.FILL, 0, 0); - unit_table.attach(unit_dependency_label, 1, 6, 2, 3, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0); - unit_table.attach(new LeftLabel("Fragment Path:"), 0, 1, 3, 4, AttachOptions.FILL, AttachOptions.FILL, 0, 0); - unit_table.attach(unit_fragment_path_label, 1, 6, 3, 4, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0); - unit_table.attach(new LeftLabel("Control Group:"), 0, 1, 4, 5, AttachOptions.FILL, AttachOptions.FILL, 0, 0); - unit_table.attach(unit_cgroup_label, 1, 6, 4, 5, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0); - - unit_table.attach(new LeftLabel("Load State:"), 0, 1, 5, 6, AttachOptions.FILL, AttachOptions.FILL, 0, 0); - unit_table.attach(unit_load_state_label, 1, 2, 5, 6, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0); - unit_table.attach(new LeftLabel("Active State:"), 0, 1, 6, 7, AttachOptions.FILL, AttachOptions.FILL, 0, 0); - unit_table.attach(unit_active_state_label, 1, 2, 6, 7, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0); - unit_table.attach(new LeftLabel("Unit State:"), 0, 1, 7, 8, AttachOptions.FILL, AttachOptions.FILL, 0, 0); - unit_table.attach(unit_sub_state_label, 1, 2, 7, 8, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0); - - unit_table.attach(new LeftLabel("Activated:"), 2, 3, 6, 7, AttachOptions.FILL, AttachOptions.FILL, 0, 0); - unit_table.attach(unit_active_enter_timestamp_label, 3, 4, 6, 7, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0); - unit_table.attach(new LeftLabel("Deactivated:"), 2, 3, 7, 8, AttachOptions.FILL, AttachOptions.FILL, 0, 0); - unit_table.attach(unit_active_exit_timestamp_label, 3, 4, 7, 8, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0); - - unit_table.attach(new LeftLabel("Can Start/Stop:"), 4, 5, 6, 7, AttachOptions.FILL, AttachOptions.FILL, 0, 0); - unit_table.attach(unit_can_start_label, 5, 6, 6, 7, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0); - unit_table.attach(new LeftLabel("Can Reload:"), 4, 5, 7, 8, AttachOptions.FILL, AttachOptions.FILL, 0, 0); - unit_table.attach(unit_can_reload_label, 5, 6, 7, 8, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0); - - job_table.attach(new LeftLabel("Id:"), 0, 1, 0, 1, AttachOptions.FILL, AttachOptions.FILL, 0, 0); - job_table.attach(job_id_label, 1, 2, 0, 1, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0); - job_table.attach(new LeftLabel("State:"), 0, 1, 1, 2, AttachOptions.FILL, AttachOptions.FILL, 0, 0); - job_table.attach(job_state_label, 1, 2, 1, 2, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0); - job_table.attach(new LeftLabel("Type:"), 0, 1, 2, 3, AttachOptions.FILL, AttachOptions.FILL, 0, 0); - job_table.attach(job_type_label, 1, 2, 2, 3, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0); - - ButtonBox bbox = new HButtonBox(); + Grid unit_grid = new Grid(); + unit_grid.column_spacing = 6; + unit_grid.row_spacing = 6; + unit_vbox.pack_start(unit_grid, false, true, 0); + + Grid job_grid = new Grid(); + job_grid.column_spacing = 6; + job_grid.column_spacing = 6; + job_vbox.pack_start(job_grid, false, true, 0); + + unit_grid.attach(new LeftLabel("Id:"), 0, 0, 1, 1); + unit_grid.attach(unit_id_label, 1, 0, 5, 1); + unit_grid.attach(new LeftLabel("Description:"), 0, 1, 1, 1); + unit_grid.attach(unit_description_label, 1, 1, 5, 1); + unit_grid.attach(new LeftLabel("Dependencies:"), 0, 2, 1, 1); + unit_grid.attach(unit_dependency_label, 1, 2, 5, 1); + unit_grid.attach(new LeftLabel("Fragment Path:"), 0, 3, 1, 1); + unit_grid.attach(unit_fragment_path_label, 1, 3, 5, 1); + unit_grid.attach(new LeftLabel("Control Group:"), 0, 4, 1, 1); + unit_grid.attach(unit_cgroup_label, 1, 4, 5, 1); + unit_grid.attach(new LeftLabel("Load State:"), 0, 5, 1, 1); + unit_grid.attach(unit_load_state_label, 1, 5, 5, 1); + + unit_grid.attach(new LeftLabel("Active State:"), 0, 6, 1, 1); + unit_grid.attach(unit_active_state_label, 1, 6, 1, 1); + unit_grid.attach(new LeftLabel("Unit State:"), 0, 7, 1, 1); + unit_grid.attach(unit_sub_state_label, 1, 7, 1, 1); + + unit_grid.attach(new LeftLabel("Activated:"), 2, 6, 1, 1); + unit_grid.attach(unit_active_enter_timestamp_label, 3, 6, 1, 1); + unit_grid.attach(new LeftLabel("Deactivated:"), 2, 7, 1, 1); + unit_grid.attach(unit_active_exit_timestamp_label, 3, 7, 1, 1); + + unit_grid.attach(new LeftLabel("Can Start/Stop:"), 4, 6, 1, 1); + unit_grid.attach(unit_can_start_label, 5, 6, 1, 1); + unit_grid.attach(new LeftLabel("Can Reload:"), 4, 7, 1, 1); + unit_grid.attach(unit_can_reload_label, 5, 7, 1, 1); + + job_grid.attach(new LeftLabel("Id:"), 0, 1, 1, 1); + job_grid.attach(job_id_label, 1, 1, 1, 1); + job_grid.attach(new LeftLabel("State:"), 0, 2, 1, 1); + job_grid.attach(job_state_label, 1, 2, 1, 1); + job_grid.attach(new LeftLabel("Type:"), 0, 3, 1, 1); + job_grid.attach(job_type_label, 1, 3, 1, 1); + + ButtonBox bbox = new ButtonBox(Orientation.HORIZONTAL); bbox.set_layout(ButtonBoxStyle.START); bbox.set_spacing(6); unit_vbox.pack_start(bbox, false, true, 0); @@ -306,7 +311,7 @@ public class MainWindow : Window { bbox.pack_start(restart_button, false, true, 0); bbox.pack_start(reload_button, false, true, 0); - bbox = new HButtonBox(); + bbox = new ButtonBox(Orientation.HORIZONTAL); bbox.set_layout(ButtonBoxStyle.START); bbox.set_spacing(6); job_vbox.pack_start(bbox, false, true, 0); diff --git a/src/wraplabel.vala b/src/wraplabel.vala deleted file mode 100644 index 49858c3..0000000 --- a/src/wraplabel.vala +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) 2005 VMware, Inc. - -// This is a translation of http://git.gnome.org/browse/meld/tree/meld/ui/wraplabel.py, -// which in turn is a translation of WrapLabel from libview. - -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -// Python translation from wrapLabel.{cc|h} by Gian Mario Tagliaretti -// Vala translation from wraplabel.py by Zbigniew Jędrzejewski-Szmek - -public class WrapLabel : Gtk.Label { - private int _wrap_width; - - public WrapLabel(string? text = null) { - this._wrap_width = 0; - var layout = get_layout(); - layout.set_wrap(Pango.WrapMode.WORD_CHAR); - if (text != null) - this.set_text(text); - this.set_alignment(0, 0); - } - - public override void size_request(out Gtk.Requisition requisition) { - int width, height; - var layout = get_layout(); - layout.get_pixel_size(out width, out height); - requisition.width = 0; - requisition.height = height; - } - - public override void size_allocate(Gdk.Rectangle allocation) { - base.size_allocate (allocation); - this._set_wrap_width(allocation.width); - } - - public new void set_text(string str) { - base.set_text(str); - this._set_wrap_width(this._wrap_width); - } - - public new void set_markup(string str) { - base.set_markup(str); - this._set_wrap_width(this._wrap_width); - } - - private void _set_wrap_width(int width) { - if (width == 0) - return; - - var layout = get_layout(); - layout.set_width(width * Pango.SCALE); - if (_wrap_width != width) { - this._wrap_width = width; - this.queue_resize(); - } - } -} -- 1.7.10.4 -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org
participants (1)
-
root@hilbert.suse.de