[goobox] update the driver status when clicking on the status icone
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [goobox] update the driver status when clicking on the status icone
- Date: Sun, 30 Dec 2018 12:08:55 +0000 (UTC)
commit d124dce0cb418b3cfc384634a69d71b2f2da937c
Author: Paolo Bacchilega <paobac src gnome org>
Date: Sun Dec 30 11:05:18 2018 +0100
update the driver status when clicking on the status icone
src/goo-player-info.c | 33 ++++++++++++++++++++++++++++++---
src/goo-player-info.h | 3 ++-
src/goo-window.c | 18 ++++++++++++++++++
3 files changed, 50 insertions(+), 4 deletions(-)
---
diff --git a/src/goo-player-info.c b/src/goo-player-info.c
index 89557a5..8a7a64b 100644
--- a/src/goo-player-info.c
+++ b/src/goo-player-info.c
@@ -51,6 +51,7 @@ struct _GooPlayerInfoPrivate {
GtkWidget *time_label;
GtkWidget *cover_image;
GtkWidget *cover_button;
+ GtkWidget *status_button;
GtkWidget *status_image;
GtkWidget *notebook;
char *total_time;
@@ -71,7 +72,8 @@ G_DEFINE_TYPE_WITH_CODE (GooPlayerInfo, goo_player_info, GTK_TYPE_BOX,
enum {
COVER_CLICKED,
- LAST_SIGNAL
+ UPDATE_STATUS,
+ LAST_SIGNAL
};
enum {
@@ -159,6 +161,14 @@ cover_button_clicked_cb (GtkWidget *button,
}
+static void
+status_button_clicked_cb (GtkWidget *button,
+ GooPlayerInfo *info)
+{
+ g_signal_emit (info, goo_player_info_signals[UPDATE_STATUS], 0);
+}
+
+
/* -- drag and drop -- */
@@ -279,9 +289,17 @@ goo_player_info_construct (GooPlayerInfo *info)
/* Status image */
+ priv->status_button = gtk_button_new ();
+ gtk_button_set_relief (GTK_BUTTON (priv->status_button), GTK_RELIEF_NONE);
+ g_signal_connect (G_OBJECT (priv->status_button),
+ "clicked",
+ G_CALLBACK (status_button_clicked_cb),
+ info);
+
priv->status_image = gtk_image_new_from_icon_name (GOO_ICON_NAME_NO_DISC, GTK_ICON_SIZE_DIALOG);
gtk_widget_set_size_request (priv->status_image, COVER_SIZE, COVER_SIZE);
gtk_widget_show (priv->cover_image);
+ gtk_container_add (GTK_CONTAINER (priv->status_button), priv->status_image);
/*gtk_container_set_border_width (GTK_CONTAINER (priv->status_image), 6);*/
/* Frame */
@@ -292,7 +310,7 @@ goo_player_info_construct (GooPlayerInfo *info)
gtk_notebook_set_show_border (GTK_NOTEBOOK (priv->notebook), FALSE);
gtk_widget_show (priv->notebook);
- gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook), priv->status_image, NULL);
+ gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook), priv->status_button, NULL);
gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook), priv->cover_button, NULL);
priv->cover_frame = gtk_frame_new (NULL);
@@ -597,7 +615,7 @@ goo_player_info_class_init (GooPlayerInfoClass *class)
widget_class->get_preferred_width = goo_player_info_get_preferred_width;
goo_player_info_signals[COVER_CLICKED] =
- g_signal_new ("cover_clicked",
+ g_signal_new ("cover_clicked",
G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GooPlayerInfoClass, cover_clicked),
@@ -605,6 +623,15 @@ goo_player_info_class_init (GooPlayerInfoClass *class)
goo_marshal_VOID__VOID,
G_TYPE_NONE,
0);
+ goo_player_info_signals[UPDATE_STATUS] =
+ g_signal_new ("update-status",
+ G_TYPE_FROM_CLASS (class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GooPlayerInfoClass, update_status),
+ NULL, NULL,
+ goo_marshal_VOID__VOID,
+ G_TYPE_NONE,
+ 0);
}
diff --git a/src/goo-player-info.h b/src/goo-player-info.h
index 08fbd87..cebe4f2 100644
--- a/src/goo-player-info.h
+++ b/src/goo-player-info.h
@@ -48,7 +48,8 @@ struct _GooPlayerInfoClass
/*<signals>*/
- void (*cover_clicked) (GooPlayerInfo *info);
+ void (*cover_clicked) (GooPlayerInfo *info);
+ void (*update_status) (GooPlayerInfo *info);
};
GType goo_player_info_get_type (void);
diff --git a/src/goo-window.c b/src/goo-window.c
index bc26f69..fc8852b 100644
--- a/src/goo-window.c
+++ b/src/goo-window.c
@@ -1789,6 +1789,20 @@ player_info_cover_clicked_cb (GooPlayerInfo *info,
}
+static void
+player_info_update_status_cb (GooPlayerInfo *info,
+ GooWindow *window)
+{
+ BraseroDrive *drive;
+
+ debug (DEBUG_INFO, "[Window] update status\n");
+
+ drive = goo_player_get_drive (window->priv->player);
+ if (drive != NULL)
+ brasero_drive_reprobe (drive);
+}
+
+
static void
window_sync_ui_with_preferences (GooWindow *window)
{
@@ -2272,6 +2286,10 @@ goo_window_construct (GooWindow *window,
"cover_clicked",
G_CALLBACK (player_info_cover_clicked_cb),
window);
+ g_signal_connect (window->priv->info,
+ "update-status",
+ G_CALLBACK (player_info_update_status_cb),
+ window);
gtk_box_pack_start (GTK_BOX (hbox), window->priv->info, TRUE, TRUE, 0);
/**/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]