aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorConor Curran <conor.curran@canonical.com>2010-09-01 00:31:55 +0100
committerConor Curran <conor.curran@canonical.com>2010-09-01 00:31:55 +0100
commit262ef2532f8aa20018a750307f3d4815933e3c47 (patch)
tree344d07427139ce4b75f748b2e2e60c2dc0aa9c2c /src
parent610f7ed87e0b95dd16ff75024672dba36028b745 (diff)
downloadayatana-indicator-sound-262ef2532f8aa20018a750307f3d4815933e3c47.tar.gz
ayatana-indicator-sound-262ef2532f8aa20018a750307f3d4815933e3c47.tar.bz2
ayatana-indicator-sound-262ef2532f8aa20018a750307f3d4815933e3c47.zip
first legit attempt at icon gutter placement failed
Diffstat (limited to 'src')
-rw-r--r--src/indicator-sound.c38
-rw-r--r--src/sound-service.c4
-rw-r--r--src/title-widget.c16
-rw-r--r--src/title-widget.h6
4 files changed, 45 insertions, 19 deletions
diff --git a/src/indicator-sound.c b/src/indicator-sound.c
index 63ad72d..0f0c32d 100644
--- a/src/indicator-sound.c
+++ b/src/indicator-sound.c
@@ -48,6 +48,7 @@ typedef struct _IndicatorSoundPrivate IndicatorSoundPrivate;
struct _IndicatorSoundPrivate
{
GtkWidget* volume_widget;
+ DbusmenuGtkMenu* menu;
};
#define INDICATOR_SOUND_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), INDICATOR_SOUND_TYPE, IndicatorSoundPrivate))
@@ -194,8 +195,10 @@ get_label (IndicatorObject * io)
static GtkImage *
get_icon (IndicatorObject * io)
{
- gchar* current_name = g_hash_table_lookup(volume_states, GINT_TO_POINTER(current_state));
- g_debug("At start-up attempting to set the image to %s", current_name);
+ gchar* current_name = g_hash_table_lookup(volume_states,
+ GINT_TO_POINTER(current_state));
+ g_debug("At start-up attempting to set the image to %s",
+ current_name);
speaker_image = indicator_image_helper(current_name);
gtk_widget_show(GTK_WIDGET(speaker_image));
return speaker_image;
@@ -207,7 +210,10 @@ get_icon (IndicatorObject * io)
static GtkMenu *
get_menu (IndicatorObject * io)
{
- DbusmenuGtkMenu *menu = dbusmenu_gtkmenu_new(INDICATOR_SOUND_DBUS_NAME, INDICATOR_SOUND_DBUS_OBJECT);
+ DbusmenuGtkMenu* menu = dbusmenu_gtkmenu_new(INDICATOR_SOUND_DBUS_NAME, INDICATOR_SOUND_DBUS_OBJECT);
+ IndicatorSoundPrivate* priv = INDICATOR_SOUND_GET_PRIVATE(INDICATOR_SOUND (io));
+ priv->menu = menu;
+
DbusmenuGtkClient *client = dbusmenu_gtkmenu_get_client(menu);
g_object_set_data (G_OBJECT (client), "indicator", io);
dbusmenu_client_add_type_handler(DBUSMENU_CLIENT(client), DBUSMENU_VOLUME_MENUITEM_TYPE, new_volume_slider_widget);
@@ -215,10 +221,11 @@ get_menu (IndicatorObject * io)
dbusmenu_client_add_type_handler(DBUSMENU_CLIENT(client), DBUSMENU_METADATA_MENUITEM_TYPE, new_metadata_widget);
dbusmenu_client_add_type_handler(DBUSMENU_CLIENT(client), DBUSMENU_TITLE_MENUITEM_TYPE, new_title_widget);
dbusmenu_client_add_type_handler(DBUSMENU_CLIENT(client), DBUSMENU_SCRUB_MENUITEM_TYPE, new_scrub_bar_widget);
-
// register Key-press listening on the menu widget as the slider does not allow this.
g_signal_connect(menu, "key-press-event", G_CALLBACK(key_press_cb), io);
- return GTK_MENU(menu);
+ priv->menu = menu;
+
+ return GTK_MENU(menu);
}
static void
@@ -274,18 +281,31 @@ new_title_widget(DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, Dbusmenu
{
g_debug("indicator-sound: new_title_widget");
- GtkWidget* title = NULL;
-
g_return_val_if_fail(DBUSMENU_IS_MENUITEM(newitem), FALSE);
g_return_val_if_fail(DBUSMENU_IS_GTKCLIENT(client), FALSE);
+ GtkWidget* title = NULL;
+ IndicatorObject *io = NULL;
+
title = title_widget_new (newitem);
GtkMenuItem *menu_title_widget = GTK_MENU_ITEM(title);
- gtk_widget_show_all(title);
+ io = g_object_get_data (G_OBJECT (client), "indicator");
+ IndicatorSoundPrivate* priv = INDICATOR_SOUND_GET_PRIVATE(INDICATOR_SOUND (io));
+
+ GtkWidget* image_item = gtk_image_menu_item_new();
+ gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(image_item),
+ title_widget_get_player_icon(TITLE_WIDGET(title)));
- dbusmenu_gtkclient_newitem_base(DBUSMENU_GTKCLIENT(client), newitem, menu_title_widget, parent);
+ gtk_widget_show_all(image_item);
+ gtk_menu_append(priv->menu, image_item);
+
+ gtk_widget_show_all(title);
+
+ dbusmenu_gtkclient_newitem_base(DBUSMENU_GTKCLIENT(client),
+ newitem,
+ menu_title_widget, parent);
return TRUE;
}
diff --git a/src/sound-service.c b/src/sound-service.c
index 12f067e..42ce116 100644
--- a/src/sound-service.c
+++ b/src/sound-service.c
@@ -41,8 +41,8 @@ service_shutdown (IndicatorService *service, gpointer user_data)
if (mainloop != NULL) {
g_debug("Service shutdown !");
// TODO: uncomment for release !!
- close_pulse_activites();
- g_main_loop_quit(mainloop);
+ //close_pulse_activites();
+ //g_main_loop_quit(mainloop);
}
return;
}
diff --git a/src/title-widget.c b/src/title-widget.c
index e9f34d6..8f0c3c5 100644
--- a/src/title-widget.c
+++ b/src/title-widget.c
@@ -35,6 +35,7 @@ struct _TitleWidgetPrivate
GtkWidget* hbox;
GtkWidget* name;
GtkWidget* player_icon;
+ GtkWidget* image_item;
DbusmenuMenuitem* twin_item;
};
@@ -73,7 +74,6 @@ title_widget_class_init (TitleWidgetClass *klass)
gobject_class->dispose = title_widget_dispose;
gobject_class->finalize = title_widget_finalize;
-
}
static void
@@ -84,12 +84,12 @@ title_widget_init (TitleWidget *self)
TitleWidgetPrivate * priv = TITLE_WIDGET_GET_PRIVATE(self);
GtkWidget *hbox;
-
+
hbox = gtk_hbox_new(FALSE, 0);
priv->hbox = hbox;
-
priv->player_icon = indicator_image_helper("sound_icon");
- gtk_box_pack_start(GTK_BOX (priv->hbox), priv->player_icon, FALSE, FALSE, 0);
+
+ //gtk_box_pack_start(GTK_BOX (priv->hbox), priv->image_item, FALSE, FALSE, 0);
}
static void
@@ -165,7 +165,13 @@ title_widget_style_name_text(TitleWidget* self)
gtk_label_set_markup (GTK_LABEL (priv->name), markup);
g_free(markup);
}
-
+
+GtkWidget* title_widget_get_player_icon(TitleWidget* self)
+{
+ TitleWidgetPrivate * priv = TITLE_WIDGET_GET_PRIVATE(self);
+ return priv->player_icon;
+}
+
/**
* transport_new:
* @returns: a new #TitleWidget.
diff --git a/src/title-widget.h b/src/title-widget.h
index fc8f169..827a8f3 100644
--- a/src/title-widget.h
+++ b/src/title-widget.h
@@ -35,16 +35,16 @@ typedef struct _TitleWidget TitleWidget;
typedef struct _TitleWidgetClass TitleWidgetClass;
struct _TitleWidgetClass {
- GtkMenuItemClass parent_class;
+ GtkMenuItemClass parent_class;
};
struct _TitleWidget {
- GtkMenuItem parent;
+ GtkMenuItem parent;
};
GType title_widget_get_type (void);
GtkWidget* title_widget_new(DbusmenuMenuitem *twin_item);
-
+GtkWidget* title_widget_get_player_icon(TitleWidget* self);
G_END_DECLS
#endif