Ken VanDine has proposed merging lp:~ken-vandine/indicator-me/remove_about_me into lp:indicator-me.
Requested reviews: Ted Gould (ted) For more details, see: https://code.launchpad.net/~ken-vandine/indicator-me/remove_about_me/+merge/66023 Removed the about me menu, it doesn't exist in oneiric. -- https://code.launchpad.net/~ken-vandine/indicator-me/remove_about_me/+merge/66023 Your team ayatana-commits is subscribed to branch lp:indicator-me.
=== modified file 'src/Makefile.am' --- src/Makefile.am 2011-02-17 15:58:10 +0000 +++ src/Makefile.am 2011-06-27 16:40:07 +0000 @@ -8,8 +8,6 @@ melibdir = $(INDICATORDIR) melib_LTLIBRARIES = libme.la libme_la_SOURCES = \ - about-me-menu-item.c \ - about-me-menu-item.h \ indicator-me.c \ dbus-shared-names.h \ gen-me-service.xml.h \ === removed file 'src/about-me-menu-item.c' --- src/about-me-menu-item.c 2010-04-14 14:52:10 +0000 +++ src/about-me-menu-item.c 1970-01-01 00:00:00 +0000 @@ -1,313 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 2; tab-width: 2 -*- */ -/* - * Copyright 2010 Canonical, Ltd. - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of either or both of the following licenses: - * - * 1) the GNU Lesser General Public License version 3, as published by the - * Free Software Foundation; and/or - * 2) the GNU Lesser General Public License version 2.1, as published by - * the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranties of - * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the applicable version of the GNU Lesser General Public - * License for more details. - * - * You should have received a copy of both the GNU Lesser General Public - * License version 3 and version 2.1 along with this program. If not, see - * <http://www.gnu.org/licenses/> - * - * Authors: - * David Barth <[email protected]> - * Cody Russell <[email protected]> - */ - -#include <sys/types.h> -#include <sys/stat.h> -#include <unistd.h> - -#include <glib/gstdio.h> - -#include <gtk/gtk.h> -#include "about-me-menu-item.h" - -static GObject* about_me_menu_item_constructor (GType type, - guint n_construct_properties, - GObjectConstructParam *construct_params); -static void about_me_menu_item_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec); -static void about_me_menu_item_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec); - -struct _AboutMeMenuItemPrivate { - GtkWidget *label; - GtkWidget *image; - GtkWidget *hbox; - gchar *realname; -}; - -enum { - PROP_0, - PROP_REALNAME -}; - -G_DEFINE_TYPE (AboutMeMenuItem, about_me_menu_item, GTK_TYPE_MENU_ITEM) - -#define GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), ABOUT_ME_TYPE_MENU_ITEM, AboutMeMenuItemPrivate)) - -static void -about_me_menu_item_class_init (AboutMeMenuItemClass *item_class) -{ - GObjectClass *gobject_class = G_OBJECT_CLASS (item_class); - - gobject_class->constructor = about_me_menu_item_constructor; - gobject_class->set_property = about_me_menu_item_set_property; - gobject_class->get_property = about_me_menu_item_get_property; - - g_object_class_install_property (gobject_class, - PROP_REALNAME, - g_param_spec_string ("realname", - "Realname", - "The \"Realname\" for the user", - NULL, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); - - g_type_class_add_private (gobject_class, sizeof (AboutMeMenuItemPrivate)); -} - -static void -about_me_menu_item_init (AboutMeMenuItem *self) -{ - AboutMeMenuItemPrivate *priv = GET_PRIVATE (self); - - priv->label = NULL; - priv->image = NULL; - priv->realname = NULL; -} - -static void -about_me_menu_item_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) -{ - AboutMeMenuItem *menu_item = ABOUT_ME_MENU_ITEM (object); - AboutMeMenuItemPrivate *priv = GET_PRIVATE (menu_item); - - switch (prop_id) - { - case PROP_REALNAME: - g_assert (priv->realname == NULL); - priv->realname = g_strdup (g_value_get_string (value)); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -about_me_menu_item_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) -{ - AboutMeMenuItem *menu_item = ABOUT_ME_MENU_ITEM (object); - AboutMeMenuItemPrivate *priv = GET_PRIVATE (menu_item); - - switch (prop_id) - { - case PROP_REALNAME: - g_value_set_string (value, priv->realname); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -#define DEFAULT_PIXELS_PER_EM 10.0f - -static gdouble -get_pixels_per_em (GtkWidget *widget) -{ - g_return_val_if_fail (GTK_IS_WIDGET (widget), DEFAULT_PIXELS_PER_EM); - - /* Note: taken from indicator-session */ - GtkStyle * style = gtk_widget_get_style(widget); - - PangoLayout * layout = pango_layout_new(gtk_widget_get_pango_context(widget)); - pango_layout_set_text(layout, "M", -1); - pango_layout_set_font_description(layout, style->font_desc); - - gint width; - pango_layout_get_pixel_size(layout, &width, NULL); - - gint point = pango_font_description_get_size(style->font_desc); - gdouble dpi = gdk_screen_get_resolution(gdk_screen_get_default()); - - return ((point * dpi) / 72.0f) / PANGO_SCALE; -} - - -/* from n-osd */ -static GdkPixbuf* -load_icon (const gchar* filename, - gint icon_size) -{ - GdkPixbuf* buffer = NULL; - GdkPixbuf* pixbuf = NULL; - GtkIconTheme* theme = NULL; - GError* error = NULL; - - /* sanity check */ - g_return_val_if_fail (filename, NULL); - - theme = gtk_icon_theme_get_default (); - buffer = gtk_icon_theme_load_icon (theme, - filename, - icon_size, - GTK_ICON_LOOKUP_FORCE_SVG | - GTK_ICON_LOOKUP_GENERIC_FALLBACK | - GTK_ICON_LOOKUP_FORCE_SIZE, - &error); - if (error) - { - g_print ("loading icon '%s' caused error: '%s'", - filename, - error->message); - g_error_free (error); - error = NULL; - pixbuf = NULL; - } - else - { - /* copy and unref buffer so on an icon-theme change old - ** icons are not kept in memory due to dangling - ** references, this also makes sure we do not need to - ** connect to GtkWidget::style-set signal for the - ** GdkPixbuf we get from gtk_icon_theme_load_icon() */ - pixbuf = gdk_pixbuf_copy (buffer); - g_object_unref (buffer); - } - - return pixbuf; -} - -gboolean -about_me_menu_item_load_avatar (AboutMeMenuItem *self, const gchar *file) -{ - g_return_val_if_fail (ABOUT_IS_ME_MENU_ITEM (self), FALSE); - - AboutMeMenuItemPrivate *priv = GET_PRIVATE (self); - - g_debug ("loading avatar from file %s", file); - - struct stat buf; - if (! (g_stat (file, &buf) == 0 && buf.st_size > 0)) { - g_warning ("%s: not found or empty", file); - return FALSE; - } - - if (buf.st_size > 1024*1024) { - g_warning ("avatar file too large (%lld)", (long long)buf.st_size); - return FALSE; - } - - GError *error = NULL; - int size = get_pixels_per_em (priv->image) * 3; - - GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file_at_scale (file, -1, size, TRUE, - &error); - if (pixbuf == NULL) { - if (error != NULL) { - g_warning ("Couldn't read file %s: %s", file, error->message); - g_error_free (error); - } - return FALSE; - } - - gtk_image_set_from_pixbuf (GTK_IMAGE (priv->image), pixbuf); - - g_object_unref (pixbuf); - - return TRUE; -} - -static void -image_size_allocate (GtkWidget *widget, - GtkAllocation *allocation, - gpointer user_data) -{ - gint max = MAX (allocation->width, allocation->height); - - gtk_widget_set_size_request (widget, max, max); -} - -static GObject* -about_me_menu_item_constructor (GType type, - guint n_construct_properties, - GObjectConstructParam *construct_params) -{ - GObject *object; - GtkWidget *hbox; - GtkWidget *align; - AboutMeMenuItemPrivate *priv; - object = G_OBJECT_CLASS (about_me_menu_item_parent_class)->constructor (type, - n_construct_properties, - construct_params); - - priv = GET_PRIVATE (object); - - GtkWidget *frame = gtk_frame_new (NULL); - gdouble pixels_per_em = get_pixels_per_em (frame); - GdkPixbuf *pixbuf = load_icon ("stock_person-panel", pixels_per_em * 3); - if (pixbuf == NULL) - pixbuf = load_icon ("stock_person", pixels_per_em * 3); - priv->image = gtk_image_new_from_pixbuf (pixbuf); - g_signal_connect (frame, "size-allocate", G_CALLBACK (image_size_allocate), NULL); - gtk_misc_set_padding (GTK_MISC (priv->image), 2, 2); - gtk_container_add (GTK_CONTAINER (frame), priv->image); - - align = gtk_alignment_new (0, 0.3, 0, 0); - priv->label = gtk_label_new (priv->realname); - gtk_misc_set_padding (GTK_MISC (priv->label), 2, 2); - gtk_container_add (GTK_CONTAINER (align), priv->label); - - hbox = gtk_hbox_new (FALSE, 0); - gtk_box_pack_start (GTK_BOX (hbox), frame, FALSE, FALSE, 0); - gtk_box_pack_start (GTK_BOX (hbox), align, TRUE, TRUE, DEFAULT_PIXELS_PER_EM); - - gtk_container_add (GTK_CONTAINER (object), hbox); - gtk_widget_show_all (GTK_WIDGET(object)); - - priv->hbox = hbox; - - return object; -} - -/** - * about_me_menu_item_new: - * @realname: the name to display in the new menu item. - * @returns: a new #AboutMeMenuItem. - * - * Creates a new #AboutMeMenuItem with a name. - **/ -GtkWidget* -about_me_menu_item_new (const gchar *realname) -{ - return g_object_new (ABOUT_ME_TYPE_MENU_ITEM, - "realname", realname, - NULL); -} - -#define __ABOUT_ME_MENU_ITEM_C__ === removed file 'src/about-me-menu-item.h' --- src/about-me-menu-item.h 2011-06-22 18:29:03 +0000 +++ src/about-me-menu-item.h 1970-01-01 00:00:00 +0000 @@ -1,66 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 2; tab-width: 2 -*- */ -/* - * Copyright 2010 Canonical, Ltd. - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of either or both of the following licenses: - * - * 1) the GNU Lesser General Public License version 3, as published by the - * Free Software Foundation; and/or - * 2) the GNU Lesser General Public License version 2.1, as published by - * the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranties of - * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the applicable version of the GNU Lesser General Public - * License for more details. - * - * You should have received a copy of both the GNU Lesser General Public - * License version 3 and version 2.1 along with this program. If not, see - * <http://www.gnu.org/licenses/> - * - * Authors: - * David Barth <[email protected]> - * Cody Russell <[email protected]> - */ - -#ifndef __ABOUT_ME_MENU_ITEM_H__ -#define __ABOUT_ME_MENU_ITEM_H__ - -#include <gtk/gtk.h> - -G_BEGIN_DECLS - -#define ABOUT_ME_TYPE_MENU_ITEM (about_me_menu_item_get_type ()) -#define ABOUT_ME_MENU_ITEM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), ABOUT_ME_TYPE_MENU_ITEM, AboutMeMenuItem)) -#define ABOUT_ME_MENU_ITEM_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), ABOUT_ME_TYPE_MENU_ITEM, AboutMeMenuItemClass)) -#define ABOUT_IS_ME_MENU_ITEM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), ABOUT_ME_TYPE_MENU_ITEM)) -#define ABOUT_IS_ME_MENU_ITEM_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), ABOUT_ME_TYPE_MENU_ITEM)) -#define ABOUT_ME_MENU_ITEM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), ABOUT_ME_TYPE_MENU_ITEM, AboutMeMenuItemClass)) - - -typedef struct _AboutMeMenuItem AboutMeMenuItem; -typedef struct _AboutMeMenuItemClass AboutMeMenuItemClass; -typedef struct _AboutMeMenuItemPrivate AboutMeMenuItemPrivate; - -struct _AboutMeMenuItem -{ - GtkMenuItem parent_instance; - - AboutMeMenuItemPrivate *priv; -}; - -struct _AboutMeMenuItemClass -{ - GtkMenuItemClass parent_class; -}; - - -GType about_me_menu_item_get_type (void) G_GNUC_CONST; -GtkWidget *about_me_menu_item_new (const gchar *name); -gboolean about_me_menu_item_load_avatar (AboutMeMenuItem *self, const gchar *file); - -G_END_DECLS - -#endif /* __ABOUT_ME_MENU_ITEM_H__ */ === modified file 'src/dbus-shared-names.h' --- src/dbus-shared-names.h 2011-01-14 21:30:09 +0000 +++ src/dbus-shared-names.h 2011-06-27 16:40:07 +0000 @@ -34,7 +34,6 @@ #define DBUSMENU_ENTRY_MENUITEM_PROP_TEXT "text" #define DBUSMENU_ENTRY_MENUITEM_PROP_HINT "hint" -#define DBUSMENU_ABOUT_ME_MENUITEM_TYPE "x-canonical-about-me-item" #define DBUSMENU_ABOUT_ME_MENUITEM_PROP_NAME "name" #define DBUSMENU_ABOUT_ME_MENUITEM_PROP_ICON "icon" === modified file 'src/indicator-me.c' --- src/indicator-me.c 2011-06-22 18:29:03 +0000 +++ src/indicator-me.c 2011-06-27 16:40:07 +0000 @@ -41,8 +41,6 @@ #include <libindicator/indicator-image-helper.h> #include <libido/idoentrymenuitem.h> -#include "about-me-menu-item.h" - #include "dbus-shared-names.h" #include "gen-me-service.xml.h" @@ -101,10 +99,6 @@ DbusmenuMenuitem * parent, DbusmenuClient * client, gpointer user_data); -static gboolean new_about_me_item (DbusmenuMenuitem * newitem, - DbusmenuMenuitem * parent, - DbusmenuClient * client, - gpointer user_data); static void entry_activate_cb (GtkEntry *entry, DbusmenuMenuitem *mi); static void entry_prop_change_cb (DbusmenuMenuitem *mi, gchar *prop, GVariant *value, GtkEntry *entry); static gboolean entry_hint_is_shown (GtkWidget *widget); @@ -665,47 +659,6 @@ return TRUE; } -/* Whenever we have a property change on a DbusmenuMenuitem - we need to be responsive to that. */ -static void -about_me_prop_change_cb (DbusmenuMenuitem * mi, gchar * prop, GVariant * value, AboutMeMenuItem *item) -{ - g_return_if_fail (ABOUT_IS_ME_MENU_ITEM (item)); - - if (!g_strcmp0(prop, DBUSMENU_ABOUT_ME_MENUITEM_PROP_ICON)) { - /* reload the avatar icon */ - about_me_menu_item_load_avatar (item, g_variant_get_string(value, NULL)); - } else if (!g_strcmp0(prop, DBUSMENU_MENUITEM_PROP_VISIBLE)) { - /* normal, ignore */ - } else { - g_warning("Indicator Item property '%s' unknown", prop); - } - - return; -} - -static gboolean -new_about_me_item (DbusmenuMenuitem * newitem, - DbusmenuMenuitem * parent, - DbusmenuClient * client, - gpointer user_data) -{ - g_return_val_if_fail(DBUSMENU_IS_MENUITEM(newitem), FALSE); - g_return_val_if_fail(DBUSMENU_IS_GTKCLIENT(client), FALSE); - /* Note: not checking parent, it's reasonable for it to be NULL */ - - const gchar *name = dbusmenu_menuitem_property_get (newitem, DBUSMENU_ABOUT_ME_MENUITEM_PROP_NAME); - AboutMeMenuItem *about = ABOUT_ME_MENU_ITEM (about_me_menu_item_new (name)); - if (about != NULL) { - dbusmenu_gtkclient_newitem_base(DBUSMENU_GTKCLIENT(client), newitem, GTK_MENU_ITEM(about), parent); - const gchar *avatar = dbusmenu_menuitem_property_get (newitem, DBUSMENU_ABOUT_ME_MENUITEM_PROP_ICON); - about_me_menu_item_load_avatar (about, avatar); - g_signal_connect(G_OBJECT(newitem), DBUSMENU_MENUITEM_SIGNAL_PROPERTY_CHANGED, G_CALLBACK(about_me_prop_change_cb), about); - } - - return TRUE; -} - /* Builds the dbusmenu for the service. */ static GtkMenu * get_menu (IndicatorObject * io) @@ -714,7 +667,6 @@ DbusmenuGtkClient * client = dbusmenu_gtkmenu_get_client(menu); dbusmenu_client_add_type_handler(DBUSMENU_CLIENT(client), DBUSMENU_ENTRY_MENUITEM_TYPE, new_entry_item); - dbusmenu_client_add_type_handler(DBUSMENU_CLIENT(client), DBUSMENU_ABOUT_ME_MENUITEM_TYPE, new_about_me_item); return GTK_MENU (menu); } === modified file 'src/me-service.c' --- src/me-service.c 2011-04-18 04:00:53 +0000 +++ src/me-service.c 2011-06-27 16:40:07 +0000 @@ -88,7 +88,6 @@ static GMainLoop * mainloop = NULL; static StatusServiceDbus * dbus_interface = NULL; static StatusProviderStatus global_status = STATUS_PROVIDER_STATUS_DISCONNECTED; -static GFileMonitor *avatar_monitor = NULL; static DbusmenuMenuitem *broadcast_field = NULL; static DbusmenuMenuitem * useritem = NULL; static GSettings *gsettings = NULL; @@ -341,48 +340,6 @@ (value == 0) ? FALSE : TRUE); } - -/* disabled for this release */ -#if 0 -static void -avatar_changed_cb (GFileMonitor * monitor, GFile * file, GFile * other_file, GFileMonitorEvent event_type, gpointer user_data) -{ - g_debug("avatar changed!"); - - g_return_if_fail (DBUSMENU_IS_MENUITEM (user_data)); - - DbusmenuMenuitem *mi = DBUSMENU_MENUITEM (user_data); - - /* whatever happened, we just update the icon property - and let the indicator reload the image */ - gchar * path = g_file_get_path (file); - dbusmenu_menuitem_property_set (mi, DBUSMENU_ABOUT_ME_MENUITEM_PROP_ICON, path); -} - -static void -build_avatar_item (DbusmenuMenuitem * root) -{ - useritem = dbusmenu_menuitem_new(); - dbusmenu_menuitem_property_set(useritem, DBUSMENU_ABOUT_ME_MENUITEM_PROP_NAME, g_get_real_name ()); - dbusmenu_menuitem_property_set_bool(useritem, DBUSMENU_MENUITEM_PROP_ENABLED, FALSE); - dbusmenu_menuitem_property_set_bool(useritem, DBUSMENU_MENUITEM_PROP_VISIBLE, FALSE); - dbusmenu_menuitem_property_set(useritem, DBUSMENU_MENUITEM_PROP_TYPE, DBUSMENU_ABOUT_ME_MENUITEM_TYPE); - dbusmenu_menuitem_child_append(root, useritem); - - /* avatar icon */ - gchar *filename = g_build_filename (g_get_home_dir (), ".face", NULL); - dbusmenu_menuitem_property_set (useritem, DBUSMENU_ABOUT_ME_MENUITEM_PROP_ICON, filename); - GFile *file = g_file_new_for_path (filename); - avatar_monitor = g_file_monitor (file, G_FILE_MONITOR_NONE, NULL, NULL); - if (avatar_monitor != NULL) - g_signal_connect (G_OBJECT (avatar_monitor), "changed", G_CALLBACK (avatar_changed_cb), useritem); - - g_free (filename); - - return; -} -#endif - #define GSETTINGS_SCHEMA "com.canonical.indicator.me" #define GSETTINGS_DISPLAY "display" @@ -392,10 +349,6 @@ DbusmenuMenuitem * root = DBUSMENU_MENUITEM(data); g_return_val_if_fail(DBUSMENU_IS_MENUITEM(root), FALSE); - /* disabled for this release */ -#if 0 - build_avatar_item(root); -#endif broadcast_field = DBUSMENU_MENUITEM (entry_menu_item_new()); dbusmenu_menuitem_property_set (broadcast_field, DBUSMENU_ENTRY_MENUITEM_PROP_HINT, _("Post message...")); @@ -433,27 +386,6 @@ build_accounts_menuitems(root); - /* add a standard "About Me..." menu item at the end of the menu */ - DbusmenuMenuitem *separator = dbusmenu_menuitem_new(); - dbusmenu_menuitem_property_set(separator, DBUSMENU_MENUITEM_PROP_TYPE, - DBUSMENU_CLIENT_TYPES_SEPARATOR); - dbusmenu_menuitem_child_append(root, separator); - - useritem = dbusmenu_menuitem_new(); - dbusmenu_menuitem_property_set(useritem, DBUSMENU_MENUITEM_PROP_LABEL, _("About Me...")); - dbusmenu_menuitem_property_set_bool(useritem, DBUSMENU_MENUITEM_PROP_ENABLED, FALSE); - dbusmenu_menuitem_property_set_bool(useritem, DBUSMENU_MENUITEM_PROP_VISIBLE, FALSE); - dbusmenu_menuitem_child_append(root, useritem); - - gchar *gam = g_find_program_in_path("gnome-about-me"); - if (gam != NULL) { - dbusmenu_menuitem_property_set_bool(useritem, DBUSMENU_MENUITEM_PROP_ENABLED, TRUE); - g_signal_connect(G_OBJECT(useritem), - DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, - G_CALLBACK(spawn_on_activate_cb), "gnome-about-me"); - g_free(gam); - } - /* finally set the menu name and update items visibility according to a gsettings key and receive display mode notifications to update it later */ @@ -470,9 +402,6 @@ { g_debug("Service shutting down"); - if (avatar_monitor != NULL) - g_object_unref (avatar_monitor); - g_main_loop_quit(mainloop); return; }
_______________________________________________ Mailing list: https://launchpad.net/~ayatana-commits Post to : [email protected] Unsubscribe : https://launchpad.net/~ayatana-commits More help : https://help.launchpad.net/ListHelp

