From 894f448bb3ce9c0cd033f486aaaedda0d7a4281b Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Wed, 2 May 2012 17:25:16 -0700 Subject: extract the strings test into their own Makefile so that we can share it among other indicators --- Makefile.am | 39 --------------------------------------- tests/Makefile.am | 5 +++++ tests/Makefile.am.strings | 38 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 39 deletions(-) create mode 100644 tests/Makefile.am.strings diff --git a/Makefile.am b/Makefile.am index ad42d8e..8fb5d77 100644 --- a/Makefile.am +++ b/Makefile.am @@ -40,43 +40,4 @@ dist-hook: echo Failed to generate AUTHORS: not a branch >&2; \ fi -TESTS = \ - test-ellipsis \ - test-space-ellipsis \ - test-ascii-quotes - -##### -# Tests for there being proper ellipsis instead of three periods in a row -##### -test-ellipsis: po - @echo "#!/bin/bash" > $@ - @echo "(cd po && make $(GETTEXT_PACKAGE).pot)" >> $@ - @echo "grep -c -e \"^msgid.*\.\.\.\\\"\" po/$(GETTEXT_PACKAGE).pot > /dev/null && echo \"Ellipsis found in user visible strings\" >&2 && exit 1" >> $@ - @echo "exit 0" >> $@ - @chmod +x $@ - -##### -# Tests for there being a space before an ellipsis -##### -test-space-ellipsis: po - @echo "#!/bin/bash" > $@ - @echo "(cd po && make $(GETTEXT_PACKAGE).pot)" >> $@ - @echo "grep -c -e \"^msgid.* …\\\"\" po/$(GETTEXT_PACKAGE).pot > /dev/null && echo \"Space before ellipsis found in user visible strings\" >&2 && exit 1" >> $@ - @echo "exit 0" >> $@ - @chmod +x $@ - -##### -# Tests for ASCII quote types -##### -test-ascii-quotes: po - @echo "#!/bin/bash" > $@ - @echo "(cd po && make $(GETTEXT_PACKAGE).pot)" >> $@ - @echo "grep -c -e \"^msgid \\\".*'.*\\\"\" po/$(GETTEXT_PACKAGE).pot > /dev/null && echo \"ASCII apostrophy found in user visible strings\" >&2 && exit 1" >> $@ - @echo "grep -c -e \"^msgid \\\".*\\\".*\\\"\" po/$(GETTEXT_PACKAGE).pot > /dev/null && echo \"ASCII quote found in user visible strings\" >&2 && exit 1" >> $@ - @echo "grep -c -e \"^msgid \\\".*\\\`.*\\\"\" po/$(GETTEXT_PACKAGE).pot > /dev/null && echo \"ASCII backtick found in user visible strings\" >&2 && exit 1" >> $@ - @echo "exit 0" >> $@ - @chmod +x $@ - -CLEANFILES = $(TESTS) - include $(top_srcdir)/Makefile.am.coverage diff --git a/tests/Makefile.am b/tests/Makefile.am index 0d30bba..5f22130 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,3 +1,8 @@ +TESTS = +CLEANFILES = + +# stock UMB tests on user-visible strings +include $(srcdir)/Makefile.am.strings AM_CPPFLAGS = \ $(GTEST_CPPFLAGS) \ diff --git a/tests/Makefile.am.strings b/tests/Makefile.am.strings new file mode 100644 index 0000000..26a23a8 --- /dev/null +++ b/tests/Makefile.am.strings @@ -0,0 +1,38 @@ +TESTS += \ + test-ellipsis \ + test-space-ellipsis \ + test-ascii-quotes + +##### +# Tests for there being proper ellipsis instead of three periods in a row +##### +test-ellipsis: $(top_srcdir)/po + @echo "#!/bin/bash" > $@ + @echo "(cd $(top_srcdir)/po && make $(GETTEXT_PACKAGE).pot)" >> $@ + @echo "grep -c -e \"^msgid.*\.\.\.\\\"\" $(top_srcdir)/po/$(GETTEXT_PACKAGE).pot > /dev/null && echo \"Ellipsis found in user visible strings\" >&2 && exit 1" >> $@ + @echo "exit 0" >> $@ + @chmod +x $@ + +##### +# Tests for there being a space before an ellipsis +##### +test-space-ellipsis: $(top_srcdir)/po + @echo "#!/bin/bash" > $@ + @echo "(cd $(top_srcdir)/po && make $(GETTEXT_PACKAGE).pot)" >> $@ + @echo "grep -c -e \"^msgid.* …\\\"\" $(top_srcdir)/po/$(GETTEXT_PACKAGE).pot > /dev/null && echo \"Space before ellipsis found in user visible strings\" >&2 && exit 1" >> $@ + @echo "exit 0" >> $@ + @chmod +x $@ + +##### +# Tests for ASCII quote types +##### +test-ascii-quotes: $(top_srcdir)/po + @echo "#!/bin/bash" > $@ + @echo "(cd $(top_srcdir)/po && make $(GETTEXT_PACKAGE).pot)" >> $@ + @echo "grep -c -e \"^msgid \\\".*'.*\\\"\" $(top_srcdir)/po/$(GETTEXT_PACKAGE).pot > /dev/null && echo \"ASCII apostrophy found in user visible strings\" >&2 && exit 1" >> $@ + @echo "grep -c -e \"^msgid \\\".*\\\".*\\\"\" $(top_srcdir)/po/$(GETTEXT_PACKAGE).pot > /dev/null && echo \"ASCII quote found in user visible strings\" >&2 && exit 1" >> $@ + @echo "grep -c -e \"^msgid \\\".*\\\`.*\\\"\" $(top_srcdir)/po/$(GETTEXT_PACKAGE).pot > /dev/null && echo \"ASCII backtick found in user visible strings\" >&2 && exit 1" >> $@ + @echo "exit 0" >> $@ + @chmod +x $@ + +CLEANFILES += $(TESTS) -- cgit v1.2.3 From 242a3396401cbd2136374236ea98808cefaae675 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Fri, 13 Jul 2012 11:18:08 -0500 Subject: bump glib requirement to 2.33 --- configure.ac | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 05983f0..5968927 100644 --- a/configure.ac +++ b/configure.ac @@ -28,6 +28,7 @@ m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) # Dependencies ########################### +GLIB_REQUIRED_VERSION=2.33 GTK_REQUIRED_VERSION=3.0 INDICATOR_REQUIRED_VERSION=0.3.19 DBUSMENUGTK_REQUIRED_VERSION=0.5.90 @@ -36,14 +37,16 @@ DBUSTEST_REQUIRED_VERSION=0.0.5 DBUSMENUGLIB_REQUIRED_VERSION=0.1.1 -PKG_CHECK_MODULES(APPLET, gtk+-3.0 >= $GTK_REQUIRED_VERSION +PKG_CHECK_MODULES(APPLET, glib-2.0 >= $GLIB_REQUIRED_VERSION + gtk+-3.0 >= $GTK_REQUIRED_VERSION indicator3-0.4 >= $INDICATOR_REQUIRED_VERSION dbusmenu-gtk3-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION) AC_SUBST(APPLET_CFLAGS) AC_SUBST(APPLET_LIBS) -PKG_CHECK_MODULES(SESSIONSERVICE, dbusmenu-glib-0.4 >= $DBUSMENUGLIB_REQUIRED_VERSION +PKG_CHECK_MODULES(SESSIONSERVICE, glib-2.0 >= $GLIB_REQUIRED_VERSION + dbusmenu-glib-0.4 >= $DBUSMENUGLIB_REQUIRED_VERSION dbusmenu-gtk3-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION dbus-glib-1 gio-unix-2.0 -- cgit v1.2.3 From 3ea027c780c433dec5443c72c6154363b889ba84 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Tue, 21 Aug 2012 19:12:32 -0500 Subject: use gtk_image_*_from_icon_name() instead of indicator_image_helper*() --- src/indicator-session.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/indicator-session.c b/src/indicator-session.c index 53ff87e..3038948 100644 --- a/src/indicator-session.c +++ b/src/indicator-session.c @@ -36,7 +36,6 @@ with this program. If not, see . #include #include #include -#include #include "shared-names.h" #include "user-widget.h" @@ -117,6 +116,8 @@ indicator_session_class_init (IndicatorSessionClass *klass) static void indicator_session_init (IndicatorSession *self) { + const gchar * icon_name; + self->settings = g_settings_new ("com.canonical.indicator.session"); /* Now let's fire these guys up. */ @@ -131,9 +132,8 @@ indicator_session_init (IndicatorSession *self) self->entry.name_hint = PACKAGE; self->entry.accessible_desc = _("Session Menu"); self->entry.label = GTK_LABEL (gtk_label_new ("User Name")); - self->entry.image = greeter_mode - ? indicator_image_helper (GREETER_ICON_DEFAULT) - : indicator_image_helper (ICON_DEFAULT); + icon_name = greeter_mode ? GREETER_ICON_DEFAULT : ICON_DEFAULT; + self->entry.image = GTK_IMAGE (gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_BUTTON)); self->entry.menu = GTK_MENU (dbusmenu_gtkmenu_new(INDICATOR_SESSION_DBUS_NAME, INDICATOR_SESSION_DBUS_OBJECT)); g_settings_bind (self->settings, "show-real-name-on-panel", @@ -341,7 +341,8 @@ receive_signal (GDBusProxy * proxy, } else if (!g_strcmp0(signal_name, "RestartRequired")) { - indicator_image_helper_update (self->entry.image, greeter_mode ? GREETER_ICON_RESTART : ICON_RESTART); + const gchar * icon_name = greeter_mode ? GREETER_ICON_RESTART : ICON_RESTART; + gtk_image_set_from_icon_name (GTK_IMAGE(self->entry.image), icon_name, GTK_ICON_SIZE_MENU); self->entry.accessible_desc = _("Device Menu (reboot required)"); g_signal_emit (G_OBJECT(self), INDICATOR_OBJECT_SIGNAL_ACCESSIBLE_DESC_UPDATE_ID, 0, &self->entry); } -- cgit v1.2.3 From 58a88cde17abc8dfaf9a047229d564f54e947677 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Tue, 21 Aug 2012 19:36:21 -0500 Subject: in the session menu, make the user menuitems the same height as the other menuitems. --- src/user-widget.c | 56 +++++++++++++++++++++++++++++-------------------------- 1 file changed, 30 insertions(+), 26 deletions(-) diff --git a/src/user-widget.c b/src/user-widget.c index b0d2dd4..79b87b0 100644 --- a/src/user-widget.c +++ b/src/user-widget.c @@ -89,9 +89,8 @@ user_widget_init (UserWidget *self) // Create the UI elements. priv->user_image = gtk_image_new (); gtk_misc_set_alignment(GTK_MISC(priv->user_image), 0.0, 0.0); - gtk_misc_set_padding (GTK_MISC(priv->user_image),0, 4.0); - priv->user_name = gtk_label_new (""); + priv->user_name = gtk_label_new (NULL); priv->container = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4); @@ -180,40 +179,43 @@ user_widget_primitive_draw_cb_gtk_3 (GtkWidget *widget, **** ***/ -static const int ICON_SIZE = 24; - static void update_icon (UserWidget * self, DbusmenuMenuitem * mi) { - GdkPixbuf * pixbuf = NULL; + gboolean updated = FALSE; + GtkImage * image = GTK_IMAGE(self->priv->user_image); - /* first, try the menuitem's icon property */ + /* first try the menuitem's icon property */ const gchar * icon_name = dbusmenu_menuitem_property_get (mi, USER_ITEM_PROP_ICON); - if (icon_name) + if (icon_name != NULL) { - GError* error = NULL; - pixbuf = gdk_pixbuf_new_from_file_at_size (icon_name, ICON_SIZE, ICON_SIZE, &error); - if (error != NULL) + int width = 18; /* arbitrary default values */ + int height = 18; + GError * err = NULL; + GdkPixbuf * pixbuf = NULL; + + /* load the image */ + gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, &width, &height); + pixbuf = gdk_pixbuf_new_from_file_at_size (icon_name, width, height, &err); + if (err == NULL) { - g_warning ("Couldn't load the image \"%s\": %s", icon_name, error->message); - g_clear_error (&error); + gtk_image_set_from_pixbuf (image, pixbuf); + g_object_unref (pixbuf); + updated = TRUE; + } + else + { + g_warning ("Couldn't load the image \"%s\": %s", icon_name, err->message); + g_clear_error (&err); } } - /* as a fallback, try to use the default user icon */ - if (pixbuf == NULL) - { - pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (), - USER_ITEM_ICON_DEFAULT, - ICON_SIZE, - GTK_ICON_LOOKUP_FORCE_SIZE, - NULL); - } - - if (pixbuf != NULL) + /* as a fallback, use the default user icon */ + if (!updated) { - gtk_image_set_from_pixbuf (GTK_IMAGE(self->priv->user_image), pixbuf); - g_object_unref (pixbuf); + gtk_image_set_from_icon_name (image, + USER_ITEM_ICON_DEFAULT, + GTK_ICON_SIZE_MENU); } } @@ -277,7 +279,9 @@ user_widget_set_twin_item (UserWidget * self, DbusmenuMenuitem * mi) /** * user_widget_new: - * @returns: a new #UserWidget. + * @item: the #DbusmenuMenuitem this widget will render. + * + * Returns: (transfer full): a new #UserWidget. **/ GtkWidget* user_widget_new (DbusmenuMenuitem *item) -- cgit v1.2.3 From 84e5c6a228d15a86f5a27300de45c6d2d28fc25b Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Wed, 22 Aug 2012 01:31:53 -0500 Subject: 12.10.1 --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 5968927..60722f9 100644 --- a/configure.ac +++ b/configure.ac @@ -4,7 +4,7 @@ AC_INIT(src/indicator-session.c) AC_PREREQ(2.53) AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(indicator-session, 12.10.0) +AM_INIT_AUTOMAKE(indicator-session, 12.10.1) AM_MAINTAINER_MODE -- cgit v1.2.3