diff options
author | Conor Curran <conor.curran@canonical.com> | 2010-06-14 19:48:11 +0100 |
---|---|---|
committer | Conor Curran <conor.curran@canonical.com> | 2010-06-14 19:48:11 +0100 |
commit | b5684bb4f3480c59d63a02b5f658382d7b0e52a7 (patch) | |
tree | 1744c1565b19e0dde95718ccd98e44b185829c5a /src/transport-bar.c | |
parent | 11741257873bf35670e2503184821e2bd075c9f6 (diff) | |
download | ayatana-indicator-sound-b5684bb4f3480c59d63a02b5f658382d7b0e52a7.tar.gz ayatana-indicator-sound-b5684bb4f3480c59d63a02b5f658382d7b0e52a7.tar.bz2 ayatana-indicator-sound-b5684bb4f3480c59d63a02b5f658382d7b0e52a7.zip |
rename of transport-bar
Diffstat (limited to 'src/transport-bar.c')
-rw-r--r-- | src/transport-bar.c | 92 |
1 files changed, 46 insertions, 46 deletions
diff --git a/src/transport-bar.c b/src/transport-bar.c index 96ae287..bc2ee40 100644 --- a/src/transport-bar.c +++ b/src/transport-bar.c @@ -30,9 +30,9 @@ with this program. If not, see <http://www.gnu.org/licenses/>. static DbusmenuMenuitem* twin_item; -typedef struct _TransportBarPrivate TransportBarPrivate; +typedef struct _TransportWidgetPrivate TransportWidgetPrivate; -struct _TransportBarPrivate +struct _TransportWidgetPrivate { GtkWidget* hbox; GtkWidget* previous_button; @@ -50,46 +50,46 @@ enum { static guint signals[LAST_SIGNAL] = { 0 }; -#define TRANSPORT_BAR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TRANSPORT_BAR_TYPE, TransportBarPrivate)) +#define TRANSPORT_WIDGET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TRANSPORT_WIDGET_TYPE, TransportWidgetPrivate)) /* Gobject boiler plate */ -static void transport_bar_class_init (TransportBarClass *klass); -static void transport_bar_init (TransportBar *self); -static void transport_bar_dispose (GObject *object); -static void transport_bar_finalize (GObject *object); +static void transport_widget_class_init (TransportWidgetClass *klass); +static void transport_widget_init (TransportWidget *self); +static void transport_widget_dispose (GObject *object); +static void transport_widget_finalize (GObject *object); /* UI and dbus callbacks */ -static gboolean transport_bar_button_press_event (GtkWidget *menuitem, +static gboolean transport_widget_button_press_event (GtkWidget *menuitem, GdkEventButton *event); -static gboolean transport_bar_button_release_event (GtkWidget *menuitem, +static gboolean transport_widget_button_release_event (GtkWidget *menuitem, GdkEventButton *event); -static gboolean transport_bar_play_button_trigger (GtkWidget *widget, +static gboolean transport_widget_play_button_trigger (GtkWidget *widget, GdkEventButton *event, gpointer user_data); -static void transport_bar_update_state(DbusmenuMenuitem* item, +static void transport_widget_update_state(DbusmenuMenuitem* item, gchar * property, GValue * value, gpointer userdata); // utility methods -static gchar* transport_bar_determine_play_label(gchar* state); +static gchar* transport_widget_determine_play_label(gchar* state); -G_DEFINE_TYPE (TransportBar, transport_bar, GTK_TYPE_MENU_ITEM); +G_DEFINE_TYPE (TransportWidget, transport_widget, GTK_TYPE_MENU_ITEM); static void -transport_bar_class_init (TransportBarClass *klass) +transport_widget_class_init (TransportWidgetClass *klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); - widget_class->button_press_event = transport_bar_button_press_event; - widget_class->button_release_event = transport_bar_button_release_event; + widget_class->button_press_event = transport_widget_button_press_event; + widget_class->button_release_event = transport_widget_button_release_event; - g_type_class_add_private (klass, sizeof (TransportBarPrivate)); + g_type_class_add_private (klass, sizeof (TransportWidgetPrivate)); - gobject_class->dispose = transport_bar_dispose; - gobject_class->finalize = transport_bar_finalize; + gobject_class->dispose = transport_widget_dispose; + gobject_class->finalize = transport_widget_finalize; signals[PLAY] = g_signal_new ("play", G_OBJECT_CLASS_TYPE (gobject_class), @@ -126,11 +126,11 @@ transport_bar_class_init (TransportBarClass *klass) } static void -transport_bar_init (TransportBar *self) +transport_widget_init (TransportWidget *self) { - g_debug("TransportBar::transport_bar_init"); + g_debug("TransportWidget::transport_widget_init"); - TransportBarPrivate * priv = TRANSPORT_BAR_GET_PRIVATE(self); + TransportWidgetPrivate * priv = TRANSPORT_WIDGET_GET_PRIVATE(self); GtkWidget *hbox; hbox = gtk_hbox_new(TRUE, 2); @@ -142,10 +142,10 @@ transport_bar_init (TransportBar *self) gtk_box_pack_start (GTK_BOX (hbox), priv->play_button, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (hbox), priv->next_button, FALSE, FALSE, 0); - g_signal_connect(priv->play_button, "button-press-event", G_CALLBACK(transport_bar_play_button_trigger), NULL); + g_signal_connect(priv->play_button, "button-press-event", G_CALLBACK(transport_widget_play_button_trigger), NULL); priv->hbox = hbox; - g_signal_connect(G_OBJECT(twin_item), "property-changed", G_CALLBACK(transport_bar_update_state), self); + g_signal_connect(G_OBJECT(twin_item), "property-changed", G_CALLBACK(transport_widget_update_state), self); gtk_widget_show_all (priv->hbox); gtk_container_add (GTK_CONTAINER (self), hbox); @@ -153,67 +153,67 @@ transport_bar_init (TransportBar *self) } static void -transport_bar_dispose (GObject *object) +transport_widget_dispose (GObject *object) { //if(IS_TRANSPORT_BAR(object) == TRUE){ - // TransportBarPrivate * priv = TRANSPORT_BAR_GET_PRIVATE(TRANSPORT_BAR(object)); + // TransportWidgetPrivate * priv = TRANSPORT_BAR_GET_PRIVATE(TRANSPORT_BAR(object)); // g_object_unref(priv->previous_button); //} - G_OBJECT_CLASS (transport_bar_parent_class)->dispose (object); + G_OBJECT_CLASS (transport_widget_parent_class)->dispose (object); } static void -transport_bar_finalize (GObject *object) +transport_widget_finalize (GObject *object) { - G_OBJECT_CLASS (transport_bar_parent_class)->finalize (object); + G_OBJECT_CLASS (transport_widget_parent_class)->finalize (object); } /* keyevents */ static gboolean -transport_bar_button_press_event (GtkWidget *menuitem, +transport_widget_button_press_event (GtkWidget *menuitem, GdkEventButton *event) { - g_debug("TransportBar::menu_press_event"); + g_debug("TransportWidget::menu_press_event"); return FALSE; } static gboolean -transport_bar_button_release_event (GtkWidget *menuitem, +transport_widget_button_release_event (GtkWidget *menuitem, GdkEventButton *event) { - g_debug("TransportBar::menu_release_event"); + g_debug("TransportWidget::menu_release_event"); return FALSE; } /* Individual keyevents on the buttons */ static gboolean -transport_bar_play_button_trigger(GtkWidget* widget, +transport_widget_play_button_trigger(GtkWidget* widget, GdkEventButton *event, gpointer user_data) { - g_debug("TransportBar::PLAY button_press_event"); + g_debug("TransportWidget::PLAY button_press_event"); return FALSE; } /** -* transport_bar_update_state() +* transport_widget_update_state() * Callback for updates from the other side of dbus **/ -static void transport_bar_update_state(DbusmenuMenuitem* item, gchar* property, +static void transport_widget_update_state(DbusmenuMenuitem* item, gchar* property, GValue* value, gpointer userdata) { - g_debug("transport_bar_update_state - with property %s", property); + g_debug("transport_widget_update_state - with property %s", property); gchar* input = g_strdup(g_value_get_string(value)); - g_debug("transport_bar_update_state - with value %s", input); + g_debug("transport_widget_update_state - with value %s", input); - TransportBar* bar = (TransportBar*)userdata; - TransportBarPrivate *priv = TRANSPORT_BAR_GET_PRIVATE(bar); + TransportWidget* bar = (TransportWidget*)userdata; + TransportWidgetPrivate *priv = TRANSPORT_WIDGET_GET_PRIVATE(bar); - gtk_button_set_label(GTK_BUTTON(priv->play_button), g_strdup(transport_bar_determine_play_label(property))); + gtk_button_set_label(GTK_BUTTON(priv->play_button), g_strdup(transport_widget_determine_play_label(property))); } // will be needed for image swapping -static gchar* transport_bar_determine_play_label(gchar* state) +static gchar* transport_widget_determine_play_label(gchar* state) { gchar* label = ">"; if(g_strcmp0(state, "pause") == 0){ @@ -227,12 +227,12 @@ static gchar* transport_bar_determine_play_label(gchar* state) /** * transport_new: - * @returns: a new #TransportBar. + * @returns: a new #TransportWidget. **/ GtkWidget* -transport_bar_new(DbusmenuMenuitem *item) +transport_widget_new(DbusmenuMenuitem *item) { twin_item = item; - return g_object_new(TRANSPORT_BAR_TYPE, NULL); + return g_object_new(TRANSPORT_WIDGET_TYPE, NULL); } |