diff options
Diffstat (limited to 'applets/notification_area')
16 files changed, 101 insertions, 80 deletions
diff --git a/applets/notification_area/Makefile.am b/applets/notification_area/Makefile.am index 365cdf5d..8f6ec8d3 100644 --- a/applets/notification_area/Makefile.am +++ b/applets/notification_area/Makefile.am @@ -83,9 +83,9 @@ $(applet_in_files): $(applet_in_files).in Makefile -e "s|\@VERSION\@|$(PACKAGE_VERSION)|" \ $< > $@ +service_in_files = org.mate.panel.applet.NotificationAreaAppletFactory.service.in if !NOTIFICATION_AREA_INPROCESS servicedir = $(datadir)/dbus-1/services -service_in_files = org.mate.panel.applet.NotificationAreaAppletFactory.service.in service_DATA = $(service_in_files:.service.in=.service) org.mate.panel.applet.NotificationAreaAppletFactory.service: $(service_in_files) diff --git a/applets/notification_area/main.c b/applets/notification_area/main.c index 2f0dafdb..71221b65 100644 --- a/applets/notification_area/main.c +++ b/applets/notification_area/main.c @@ -73,7 +73,6 @@ static void (*parent_class_style_updated) (GtkWidget *widget); static void (*parent_class_change_background)(MatePanelApplet* panel_applet, MatePanelAppletBackgroundType type, GdkRGBA* color, cairo_pattern_t* pattern); static void (*parent_class_change_orient)(MatePanelApplet *panel_applet, MatePanelAppletOrient orient); - #ifdef PROVIDE_WATCHER_SERVICE /* Quite dirty way of providing the org.kde.StatusNotifierWatcher service * ourselves, in case the session doesn't already */ @@ -103,7 +102,6 @@ sn_watcher_service_ref (void) } #endif - static GtkOrientation get_gtk_orientation_from_applet_orient (MatePanelAppletOrient orient) { @@ -141,7 +139,7 @@ static void setup_gsettings (NaTrayApplet *applet) { applet->priv->settings = mate_panel_applet_settings_new (MATE_PANEL_APPLET (applet), NA_TRAY_SCHEMA); - g_signal_connect (applet->priv->settings, "changed::" KEY_MIN_ICON_SIZE, G_CALLBACK (gsettings_changed_min_icon_size), applet); + g_signal_connect_object (G_OBJECT(applet->priv->settings), "changed::" KEY_MIN_ICON_SIZE, G_CALLBACK (gsettings_changed_min_icon_size), applet, 0); } static void @@ -201,7 +199,7 @@ ensure_prefs_window_is_created (NaTrayApplet *applet) g_signal_connect_swapped (applet->priv->dialog->preferences_dialog, "response", G_CALLBACK (na_preferences_dialog_response), applet); - g_signal_connect (G_OBJECT (applet->priv->dialog->preferences_dialog), "delete_event", + g_signal_connect (applet->priv->dialog->preferences_dialog, "delete-event", G_CALLBACK (na_preferences_dialog_hide_event), applet); } @@ -300,7 +298,6 @@ static const GtkActionEntry menu_actions [] = { G_CALLBACK (about_cb) } }; - static void na_tray_applet_realize (GtkWidget *widget) { @@ -497,11 +494,6 @@ applet_factory (MatePanelApplet *applet, strcmp (iid, "SystemTrayApplet") == 0)) return FALSE; - if (!GDK_IS_X11_DISPLAY (gtk_widget_get_display (GTK_WIDGET (applet)))) { - g_warning ("Notification area only works on X"); - return FALSE; - } - #ifndef NOTIFICATION_AREA_INPROCESS gtk_window_set_default_icon_name (NOTIFICATION_AREA_ICON); #endif diff --git a/applets/notification_area/main.h b/applets/notification_area/main.h index 32041cdf..a4325ba5 100644 --- a/applets/notification_area/main.h +++ b/applets/notification_area/main.h @@ -17,7 +17,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - #ifndef __NA_TRAY_APPLET_H__ #define __NA_TRAY_APPLET_H__ diff --git a/applets/notification_area/na-grid.c b/applets/notification_area/na-grid.c index dbd95d50..9a4c45d9 100644 --- a/applets/notification_area/na-grid.c +++ b/applets/notification_area/na-grid.c @@ -316,21 +316,31 @@ na_grid_realize (GtkWidget *widget) { NaGrid *self = NA_GRID (widget); GdkScreen *screen; - GtkOrientation orientation; - NaHost *tray_host; + GdkDisplay *display; + GSettings *settings; GTK_WIDGET_CLASS (na_grid_parent_class)->realize (widget); + display = gdk_display_get_default (); /* Instantiate the hosts now we have a screen */ screen = gtk_widget_get_screen (GTK_WIDGET (self)); - orientation = gtk_orientable_get_orientation (GTK_ORIENTABLE (self)); - tray_host = na_tray_new_for_screen (screen, orientation); - g_object_bind_property (self, "orientation", + if (GDK_IS_X11_DISPLAY (display)) + { + GtkOrientation orientation; + NaHost *tray_host; + + orientation = gtk_orientable_get_orientation (GTK_ORIENTABLE (self)); + tray_host = na_tray_new_for_screen (screen, orientation); + g_object_bind_property (self, "orientation", tray_host, "orientation", G_BINDING_DEFAULT); - add_host (self, tray_host); - add_host (self, sn_host_v0_new ()); + add_host (self, tray_host); + } + settings = g_settings_new ("org.mate.panel"); + if (g_settings_get_boolean (settings, "enable-sni-support")) + add_host (self, sn_host_v0_new ()); + g_object_unref (settings); } static void diff --git a/applets/notification_area/org.mate.panel.NotificationAreaApplet.mate-panel-applet.desktop.in.in b/applets/notification_area/org.mate.panel.NotificationAreaApplet.mate-panel-applet.desktop.in.in index f7652db6..811348bc 100644 --- a/applets/notification_area/org.mate.panel.NotificationAreaApplet.mate-panel-applet.desktop.in.in +++ b/applets/notification_area/org.mate.panel.NotificationAreaApplet.mate-panel-applet.desktop.in.in @@ -11,7 +11,7 @@ Description=Area where notification icons appear # Translators: Do NOT translate or transliterate this text (this is an icon file name)! Icon=mate-panel-notification-area MateComponentId=OAFIID:MATE_NotificationAreaApplet;OAFIID:MATE_SystemTrayApplet; -Platforms=X11; +Platforms=X11;Wayland; X-MATE-Bugzilla-Bugzilla=MATE X-MATE-Bugzilla-Product=mate-panel X-MATE-Bugzilla-Component=notification area diff --git a/applets/notification_area/status-notifier/sn-dbus-menu-item.c b/applets/notification_area/status-notifier/sn-dbus-menu-item.c index 62f21ca7..07d1957e 100644 --- a/applets/notification_area/status-notifier/sn-dbus-menu-item.c +++ b/applets/notification_area/status-notifier/sn-dbus-menu-item.c @@ -16,11 +16,12 @@ */ #include <config.h> +#include <libmate-desktop/mate-image-menu-item.h> #include "sn-dbus-menu-item.h" static GdkPixbuf * -pxibuf_new (GVariant *variant) +pixbuf_new (GVariant *variant) { gsize length; const guchar *data; @@ -149,7 +150,7 @@ sn_dbus_menu_item_new (GVariant *props) else if (g_strcmp0 (prop, "icon-name") == 0) item->icon_name = g_variant_dup_string (value, NULL); else if (g_strcmp0 (prop, "icon-data") == 0) - item->icon_data = pxibuf_new (value); + item->icon_data = pixbuf_new (value); else if (g_strcmp0 (prop, "label") == 0) item->label = g_variant_dup_string (value, NULL); else if (g_strcmp0 (prop, "shortcut") == 0) @@ -203,8 +204,8 @@ sn_dbus_menu_item_new (GVariant *props) cairo_surface_destroy (surface); } - item->item = gtk_image_menu_item_new (); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item->item), + item->item = mate_image_menu_item_new (); + mate_image_menu_item_set_image (MATE_IMAGE_MENU_ITEM (item->item), image); } @@ -252,7 +253,7 @@ sn_dbus_menu_item_new (GVariant *props) } void -sn_dubs_menu_item_free (gpointer data) +sn_dbus_menu_item_free (gpointer data) { SnDBusMenuItem *item; @@ -325,7 +326,7 @@ sn_dbus_menu_item_update_props (SnDBusMenuItem *item, image = NULL; } - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item->item), + mate_image_menu_item_set_image (MATE_IMAGE_MENU_ITEM (item->item), image); } else if (g_strcmp0 (prop, "icon-data") == 0) @@ -333,7 +334,7 @@ sn_dbus_menu_item_update_props (SnDBusMenuItem *item, GtkWidget *image; g_clear_object (&item->icon_data); - item->icon_data = pxibuf_new (value); + item->icon_data = pixbuf_new (value); if (item->icon_data) { @@ -347,7 +348,7 @@ sn_dbus_menu_item_update_props (SnDBusMenuItem *item, image = NULL; } - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item->item), + mate_image_menu_item_set_image (MATE_IMAGE_MENU_ITEM (item->item), image); } else if (g_strcmp0 (prop, "label") == 0) @@ -437,18 +438,18 @@ sn_dbus_menu_item_remove_props (SnDBusMenuItem *item, else if (g_strcmp0 (prop, "icon-name") == 0) { g_clear_pointer (&item->icon_name, g_free); - if (GTK_IS_IMAGE_MENU_ITEM (item->item)) + if (MATE_IS_IMAGE_MENU_ITEM (item->item)) { - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item->item), + mate_image_menu_item_set_image (MATE_IMAGE_MENU_ITEM (item->item), NULL); } } else if (g_strcmp0 (prop, "icon-data") == 0) { g_clear_object (&item->icon_data); - if (GTK_IS_IMAGE_MENU_ITEM (item->item)) + if (MATE_IS_IMAGE_MENU_ITEM (item->item)) { - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item->item), + mate_image_menu_item_set_image (MATE_IMAGE_MENU_ITEM (item->item), NULL); } } diff --git a/applets/notification_area/status-notifier/sn-dbus-menu-item.h b/applets/notification_area/status-notifier/sn-dbus-menu-item.h index c89de5c3..458417f2 100644 --- a/applets/notification_area/status-notifier/sn-dbus-menu-item.h +++ b/applets/notification_area/status-notifier/sn-dbus-menu-item.h @@ -16,7 +16,7 @@ */ #ifndef SN_DBUS_MENU_ITEM_H -#define SN_DUBS_MENU_ITEM_H +#define SN_DBUS_MENU_ITEM_H #include <gtk/gtk.h> @@ -51,7 +51,7 @@ typedef struct SnDBusMenuItem *sn_dbus_menu_item_new (GVariant *props); -void sn_dubs_menu_item_free (gpointer data); +void sn_dbus_menu_item_free (gpointer data); void sn_dbus_menu_item_update_props (SnDBusMenuItem *item, GVariant *props); diff --git a/applets/notification_area/status-notifier/sn-dbus-menu.c b/applets/notification_area/status-notifier/sn-dbus-menu.c index 03a95a4b..7b25c63f 100644 --- a/applets/notification_area/status-notifier/sn-dbus-menu.c +++ b/applets/notification_area/status-notifier/sn-dbus-menu.c @@ -419,8 +419,8 @@ sn_dbus_menu_finalize (GObject *object) menu = SN_DBUS_MENU (object); - g_free (menu->bus_name); - g_free (menu->object_path); + g_clear_pointer (&menu->bus_name, g_free); + g_clear_pointer (&menu->object_path, g_free); G_OBJECT_CLASS (sn_dbus_menu_parent_class)->finalize (object); } @@ -485,7 +485,7 @@ sn_dbus_menu_class_init (SnDBusMenuClass *menu_class) static void sn_dbus_menu_init (SnDBusMenu *menu) { - menu->items = g_hash_table_new_full (NULL, NULL, NULL, sn_dubs_menu_item_free); + menu->items = g_hash_table_new_full (NULL, NULL, NULL, sn_dbus_menu_item_free); menu->cancellable = g_cancellable_new (); } diff --git a/applets/notification_area/status-notifier/sn-host-v0.c b/applets/notification_area/status-notifier/sn-host-v0.c index 64da5da9..4ad6b359 100644 --- a/applets/notification_area/status-notifier/sn-host-v0.c +++ b/applets/notification_area/status-notifier/sn-host-v0.c @@ -193,7 +193,6 @@ register_host_cb (GObject *source_object, GError *error; SnHostV0 *v0; gchar **items; - gint i; error = NULL; sn_watcher_v0_gen_call_register_host_finish (SN_WATCHER_V0_GEN (source_object), @@ -224,7 +223,7 @@ register_host_cb (GObject *source_object, items = sn_watcher_v0_gen_dup_registered_items (v0->watcher); if (items) { - for (i = 0; items[i] != NULL; i++) + for (gint i = 0; items[i] != NULL; i++) add_registered_item (v0, items[i]); } diff --git a/applets/notification_area/status-notifier/sn-item-v0.c b/applets/notification_area/status-notifier/sn-item-v0.c index 3ec4d037..9deab9d3 100644 --- a/applets/notification_area/status-notifier/sn-item-v0.c +++ b/applets/notification_area/status-notifier/sn-item-v0.c @@ -156,7 +156,7 @@ compare_size (gconstpointer a, } static cairo_surface_t * -get_surface (SnItemV0 *v0, +get_surface (SnIconPixmap **icon_pixmap, GtkOrientation orientation, gint size) { @@ -165,10 +165,10 @@ get_surface (SnItemV0 *v0, SnIconPixmap *pixmap = NULL; GList *l; - g_assert (v0->icon_pixmap != NULL && v0->icon_pixmap[0] != NULL); + g_assert (icon_pixmap != NULL && icon_pixmap[0] != NULL); - for (i = 0; v0->icon_pixmap[i] != NULL; i++) - pixmaps = g_list_prepend (pixmaps, v0->icon_pixmap[i]); + for (i = 0; icon_pixmap[i] != NULL; i++) + pixmaps = g_list_prepend (pixmaps, icon_pixmap[i]); pixmaps = g_list_sort_with_data (pixmaps, compare_size, GUINT_TO_POINTER (orientation)); @@ -234,6 +234,9 @@ get_icon_by_name (const gchar *icon_name, NULL, GTK_ICON_LOOKUP_FORCE_SIZE, NULL); } +#define ICON_NAME_VALID(icon_name) (icon_name && icon_name[0] != '\0') +#define ICON_PIXMAP_VALID(icon_pixmap) (icon_pixmap && icon_pixmap[0] != NULL) + static void update (SnItemV0 *v0) { @@ -241,7 +244,9 @@ update (SnItemV0 *v0) GtkImage *image; SnTooltip *tip; gint icon_size; - gboolean visible; + const gchar *icon_name; + SnIconPixmap **icon_pixmap; + g_return_if_fail (SN_IS_ITEM_V0 (v0)); image = GTK_IMAGE (v0->image); @@ -251,19 +256,34 @@ update (SnItemV0 *v0) else icon_size = MAX (1, v0->effective_icon_size); - if (v0->icon_name != NULL && v0->icon_name[0] != '\0') + /* If the item requests attention and has a specific icon for it, use that + * instead of the default icon. */ + if (g_strcmp0 (v0->status, "NeedsAttention") == 0 && + (ICON_NAME_VALID (v0->attention_icon_name) || + ICON_PIXMAP_VALID (v0->attention_icon_pixmap))) + { + icon_name = v0->attention_icon_name; + icon_pixmap = v0->attention_icon_pixmap; + } + else + { + icon_name = v0->icon_name; + icon_pixmap = v0->icon_pixmap; + } + + if (ICON_NAME_VALID (icon_name)) { cairo_surface_t *surface; gint scale; scale = gtk_widget_get_scale_factor (GTK_WIDGET (image)); - surface = get_icon_by_name (v0->icon_name, icon_size, scale); + surface = get_icon_by_name (icon_name, icon_size, scale); if (!surface) { GdkPixbuf *pixbuf; /*try to find icons specified by path and filename*/ - pixbuf = gdk_pixbuf_new_from_file (v0->icon_name, NULL); + pixbuf = gdk_pixbuf_new_from_file (icon_name, NULL); if (pixbuf && icon_size > 1) { /*An icon specified by path and filename may be the wrong size for the tray */ @@ -281,11 +301,11 @@ update (SnItemV0 *v0) gtk_image_set_from_surface (image, surface); cairo_surface_destroy (surface); } - else if (v0->icon_pixmap != NULL && v0->icon_pixmap[0] != NULL) + else if (ICON_PIXMAP_VALID (icon_pixmap)) { cairo_surface_t *surface; - surface = get_surface (v0, + surface = get_surface (icon_pixmap, gtk_orientable_get_orientation (GTK_ORIENTABLE (v0)), icon_size); if (surface != NULL) @@ -341,7 +361,7 @@ update (SnItemV0 *v0) /* TODO: hide "Passive" items with a setting? */ /*Special case mate-polkit*/ if (g_strcmp0 (v0->status, "password-dialog") != 0){ - visible = g_strcmp0 (v0->status, "Passive") != 0; + gboolean visible = g_strcmp0 (v0->status, "Passive") != 0; gtk_widget_set_visible (GTK_WIDGET (v0), visible); } else @@ -640,7 +660,7 @@ update_title (GObject *source_object, v0 = SN_ITEM_V0 (user_data); - g_clear_pointer (&v0->title, g_free); + g_free (v0->title); v0->title = g_variant_dup_string (variant, NULL); g_clear_pointer (&variant, g_variant_unref); @@ -668,7 +688,7 @@ update_icon_name (GObject *source_object, v0 = SN_ITEM_V0 (user_data); - g_clear_pointer (&v0->icon_name, g_free); + g_free (v0->icon_name); v0->icon_name = g_variant_dup_string (variant, NULL); g_clear_pointer (&variant, g_variant_unref); @@ -719,7 +739,7 @@ update_overlay_icon_name (GObject *source_object, v0 = SN_ITEM_V0 (user_data); - g_clear_pointer (&v0->overlay_icon_name, g_free); + g_free (v0->overlay_icon_name); v0->overlay_icon_name = g_variant_dup_string (variant, NULL); g_clear_pointer (&variant, g_variant_unref); @@ -770,7 +790,7 @@ update_attention_icon_name (GObject *source_object, v0 = SN_ITEM_V0 (user_data); - g_clear_pointer (&v0->attention_icon_name, g_free); + g_free (v0->attention_icon_name); v0->attention_icon_name = g_variant_dup_string (variant, NULL); g_clear_pointer (&variant, g_variant_unref); @@ -792,7 +812,7 @@ update_attention_icon_pixmap (GObject *source_object, v0 = SN_ITEM_V0 (user_data); - g_clear_pointer (&v0->attention_icon_pixmap, icon_pixmap_free); + icon_pixmap_free (v0->attention_icon_pixmap); v0->attention_icon_pixmap = icon_pixmap_new (variant); g_clear_pointer (&variant, g_variant_unref); @@ -821,7 +841,7 @@ update_tooltip (GObject *source_object, v0 = SN_ITEM_V0 (user_data); - g_clear_pointer (&v0->tooltip, sn_tooltip_free); + sn_tooltip_free (v0->tooltip); v0->tooltip = sn_tooltip_new (variant); g_clear_pointer (&variant, g_variant_unref); diff --git a/applets/notification_area/status-notifier/sn-item.c b/applets/notification_area/status-notifier/sn-item.c index 3dd0d605..9677e67e 100644 --- a/applets/notification_area/status-notifier/sn-item.c +++ b/applets/notification_area/status-notifier/sn-item.c @@ -358,6 +358,7 @@ sn_item_ready (SnItem *item) priv = SN_ITEM (item)->priv; priv->menu = sn_dbus_menu_new (priv->bus_name, menu); g_object_ref_sink (priv->menu); + gtk_button_set_always_show_image (GTK_BUTTON (item),TRUE); } static const gchar * diff --git a/applets/notification_area/system-tray/fixedtip.c b/applets/notification_area/system-tray/fixedtip.c index 180cbdd7..528e1767 100644 --- a/applets/notification_area/system-tray/fixedtip.c +++ b/applets/notification_area/system-tray/fixedtip.c @@ -128,7 +128,7 @@ na_fixed_tip_init (NaFixedTip *fixedtip) gtk_widget_add_events (GTK_WIDGET (fixedtip), GDK_BUTTON_PRESS_MASK); - g_signal_connect (fixedtip, "button_press_event", + g_signal_connect (fixedtip, "button-press-event", G_CALLBACK (button_press_handler), NULL); fixedtip->priv->orientation = GTK_ORIENTATION_HORIZONTAL; diff --git a/applets/notification_area/system-tray/na-tray-child.c b/applets/notification_area/system-tray/na-tray-child.c index cd7c305a..9eb03e22 100644 --- a/applets/notification_area/system-tray/na-tray-child.c +++ b/applets/notification_area/system-tray/na-tray-child.c @@ -546,7 +546,7 @@ na_tray_child_set_composited (NaTrayChild *child, if (child->composited == composited) return; - child->composited = composited; + child->composited = (composited != FALSE); if (gtk_widget_get_realized (GTK_WIDGET (child))) gdk_window_set_composited (gtk_widget_get_window (GTK_WIDGET (child)), composited); diff --git a/applets/notification_area/system-tray/na-tray-manager.c b/applets/notification_area/system-tray/na-tray-manager.c index f001c653..2bb679d8 100644 --- a/applets/notification_area/system-tray/na-tray-manager.c +++ b/applets/notification_area/system-tray/na-tray-manager.c @@ -148,7 +148,7 @@ na_tray_manager_class_init (NaTrayManagerClass *klass) G_PARAM_STATIC_BLURB)); manager_signals[TRAY_ICON_ADDED] = - g_signal_new ("tray_icon_added", + g_signal_new ("tray-icon-added", G_OBJECT_CLASS_TYPE (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (NaTrayManagerClass, tray_icon_added), @@ -158,7 +158,7 @@ na_tray_manager_class_init (NaTrayManagerClass *klass) GTK_TYPE_SOCKET); manager_signals[TRAY_ICON_REMOVED] = - g_signal_new ("tray_icon_removed", + g_signal_new ("tray-icon-removed", G_OBJECT_CLASS_TYPE (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (NaTrayManagerClass, tray_icon_removed), @@ -167,7 +167,7 @@ na_tray_manager_class_init (NaTrayManagerClass *klass) G_TYPE_NONE, 1, GTK_TYPE_SOCKET); manager_signals[MESSAGE_SENT] = - g_signal_new ("message_sent", + g_signal_new ("message-sent", G_OBJECT_CLASS_TYPE (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (NaTrayManagerClass, message_sent), @@ -179,7 +179,7 @@ na_tray_manager_class_init (NaTrayManagerClass *klass) G_TYPE_LONG, G_TYPE_LONG); manager_signals[MESSAGE_CANCELLED] = - g_signal_new ("message_cancelled", + g_signal_new ("message-cancelled", G_OBJECT_CLASS_TYPE (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (NaTrayManagerClass, message_cancelled), @@ -306,7 +306,7 @@ na_tray_manager_handle_dock_request (NaTrayManager *manager, return; } - g_signal_connect (child, "plug_removed", + g_signal_connect (child, "plug-removed", G_CALLBACK (na_tray_manager_plug_removed), manager); gtk_socket_add_id (GTK_SOCKET (child), icon_window); @@ -537,7 +537,6 @@ na_tray_manager_unmanage (NaTrayManager *manager) { #ifdef GDK_WINDOWING_X11 GdkDisplay *display; - guint32 timestamp; GtkWidget *invisible; GdkWindow *window; @@ -556,7 +555,7 @@ na_tray_manager_unmanage (NaTrayManager *manager) if (gdk_selection_owner_get_for_display (display, manager->selection_atom) == window) { - timestamp = gdk_x11_get_server_time (window); + guint32 timestamp = gdk_x11_get_server_time (window); gdk_selection_owner_set_for_display (display, NULL, manager->selection_atom, diff --git a/applets/notification_area/system-tray/na-tray.c b/applets/notification_area/system-tray/na-tray.c index fee75dc8..8e4c3068 100644 --- a/applets/notification_area/system-tray/na-tray.c +++ b/applets/notification_area/system-tray/na-tray.c @@ -161,13 +161,9 @@ static void icon_tip_buffer_free (gpointer data, gpointer userdata) { - IconTipBuffer *buffer; - - buffer = data; + IconTipBuffer *buffer = data; g_free (buffer->text); - buffer->text = NULL; - g_free (buffer); } @@ -456,16 +452,16 @@ na_tray_constructor (GType type, { trays_screens [screen_number].tray_manager = tray_manager; - g_signal_connect (tray_manager, "tray_icon_added", + g_signal_connect (tray_manager, "tray-icon-added", G_CALLBACK (tray_added), &trays_screens [screen_number]); - g_signal_connect (tray_manager, "tray_icon_removed", + g_signal_connect (tray_manager, "tray-icon-removed", G_CALLBACK (tray_removed), &trays_screens [screen_number]); - g_signal_connect (tray_manager, "message_sent", + g_signal_connect (tray_manager, "message-sent", G_CALLBACK (message_sent), &trays_screens [screen_number]); - g_signal_connect (tray_manager, "message_cancelled", + g_signal_connect (tray_manager, "message-cancelled", G_CALLBACK (message_cancelled), &trays_screens [screen_number]); diff --git a/applets/notification_area/testtray.c b/applets/notification_area/testtray.c index b7d884f4..15252b71 100644 --- a/applets/notification_area/testtray.c +++ b/applets/notification_area/testtray.c @@ -86,12 +86,16 @@ tray_removed_cb (GtkContainer *box, GtkWidget *icon, TrayData *data) static void orientation_changed_cb (GtkComboBox *combo, TrayData *data) { - GtkOrientation orientation = (GtkOrientation) gtk_combo_box_get_active (combo); - - g_print ("[Screen %u tray %p] Setting orientation to \"%s\"\n", - data->screen_num, data->traybox, orientation == 0 ? "horizontal" : "vertical"); - - gtk_orientable_set_orientation (GTK_ORIENTABLE (data->traybox), orientation); + gint active; + + if ((active = gtk_combo_box_get_active (combo)) != -1) { + GtkOrientation orientation = (GtkOrientation) active; + g_print ("[Screen %u tray %p] Setting orientation to \"%s\"\n", + data->screen_num, + data->traybox, + orientation == GTK_ORIENTATION_HORIZONTAL ? "horizontal" : "vertical"); + gtk_orientable_set_orientation (GTK_ORIENTABLE (data->traybox), orientation); + } } static void |