[totem] main: Use app level spinner instead of waiting cursor
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [totem] main: Use app level spinner instead of waiting cursor
- Date: Sun, 26 Jan 2014 20:13:59 +0000 (UTC)
commit 0608ad4a6150ac8cddca58addcfab62fcf88260f
Author: Bastien Nocera <hadess hadess net>
Date: Sun Jan 26 21:01:22 2014 +0100
main: Use app level spinner instead of waiting cursor
Instead of using a waiting cursor when long operations are on-going,
use g_application_mark_busy(), which translates to a spinner in the
top bar in gnome-shell.
src/backend/video-utils.c | 12 ------------
src/backend/video-utils.h | 1 -
src/totem-object.c | 12 ++++++------
src/totem-playlist.c | 27 ++++-----------------------
src/totem.c | 4 ++--
5 files changed, 12 insertions(+), 44 deletions(-)
---
diff --git a/src/backend/video-utils.c b/src/backend/video-utils.c
index 8ea3ff3..e341912 100644
--- a/src/backend/video-utils.c
+++ b/src/backend/video-utils.c
@@ -44,15 +44,3 @@ totem_gdk_window_set_invisible_cursor (GdkWindow *window)
gdk_window_set_cursor (window, cursor);
g_object_unref (cursor);
}
-
-void
-totem_gdk_window_set_waiting_cursor (GdkWindow *window)
-{
- GdkCursor *cursor;
-
- cursor = gdk_cursor_new (GDK_WATCH);
- gdk_window_set_cursor (window, cursor);
- g_object_unref (cursor);
-
- gdk_flush ();
-}
diff --git a/src/backend/video-utils.h b/src/backend/video-utils.h
index eb777dd..02ea22b 100644
--- a/src/backend/video-utils.h
+++ b/src/backend/video-utils.h
@@ -29,4 +29,3 @@
#include <gtk/gtk.h>
void totem_gdk_window_set_invisible_cursor (GdkWindow *window);
-void totem_gdk_window_set_waiting_cursor (GdkWindow *window);
diff --git a/src/totem-object.c b/src/totem-object.c
index 71f04c3..7964556 100644
--- a/src/totem-object.c
+++ b/src/totem-object.c
@@ -1750,11 +1750,11 @@ totem_object_set_mrl (TotemObject *totem,
bacon_video_widget_set_user_agent (totem->bvw, user_agent);
g_free (user_agent);
- totem_gdk_window_set_waiting_cursor (gtk_widget_get_window (totem->win));
+ g_application_mark_busy (G_APPLICATION (totem));
bacon_video_widget_open (totem->bvw, mrl);
bacon_video_widget_set_text_subtitle (totem->bvw, subtitle ? subtitle : autoload_sub);
g_free (autoload_sub);
- gdk_window_set_cursor (gtk_widget_get_window (totem->win), NULL);
+ g_application_unmark_busy (G_APPLICATION (totem));
totem->mrl = g_strdup (mrl);
/* Play/Pause */
@@ -2259,10 +2259,10 @@ on_got_redirect (BaconVideoWidget *bvw, const char *mrl, TotemObject *totem)
bacon_video_widget_close (totem->bvw);
emit_file_closed (totem);
totem->has_played_emitted = FALSE;
- totem_gdk_window_set_waiting_cursor (gtk_widget_get_window (totem->win));
+ g_application_mark_busy (G_APPLICATION (totem));
bacon_video_widget_open (totem->bvw, new_mrl ? new_mrl : mrl);
emit_file_opened (totem, new_mrl ? new_mrl : mrl);
- gdk_window_set_cursor (gtk_widget_get_window (totem->win), NULL);
+ g_application_unmark_busy (G_APPLICATION (totem));
if (bacon_video_widget_play (bvw, NULL) != FALSE) {
totem_file_has_played (totem, totem->mrl);
totem->has_played_emitted = TRUE;
@@ -2550,7 +2550,7 @@ totem_object_open_files_list (TotemObject *totem, GSList *list)
if (list == NULL)
return changed;
- totem_gdk_window_set_waiting_cursor (gtk_widget_get_window (totem->win));
+ g_application_mark_busy (G_APPLICATION (totem));
for (l = list ; l != NULL; l = l->next)
{
@@ -2607,7 +2607,7 @@ totem_object_open_files_list (TotemObject *totem, GSList *list)
if (mrl_list != NULL)
totem_playlist_add_mrls (totem->playlist, g_list_reverse (mrl_list), FALSE, NULL, NULL, NULL);
- gdk_window_set_cursor (gtk_widget_get_window (totem->win), NULL);
+ g_application_unmark_busy (G_APPLICATION (totem));
/* ... and reconnect because we're nice people */
if (cleared != FALSE)
diff --git a/src/totem-playlist.c b/src/totem-playlist.c
index 0b0efd0..85e6e30 100644
--- a/src/totem-playlist.c
+++ b/src/totem-playlist.c
@@ -91,9 +91,6 @@ struct TotemPlaylistPrivate
GtkTreePath *tree_path;
GtkTreeViewDropPosition drop_pos;
- /* Cursor ref: 0 if the cursor is unbusy; positive numbers indicate the number of nested calls to
set_waiting_cursor() */
- guint cursor_ref;
-
/* Current time in the track */
char *starttime;
@@ -179,22 +176,6 @@ totem_playlist_get_toplevel (TotemPlaylist *playlist)
}
static void
-set_waiting_cursor (TotemPlaylist *playlist)
-{
- /* FIXME: Use g_application_mark_busy()
- totem_gdk_window_set_waiting_cursor (gtk_widget_get_window (GTK_WIDGET (totem_playlist_get_toplevel
(playlist))));
- playlist->priv->cursor_ref++; */
-}
-
-static void
-unset_waiting_cursor (TotemPlaylist *playlist)
-{
- /* FIXME: Use g_application_unmark_busy()
- if (--playlist->priv->cursor_ref < 1)
- gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET (totem_playlist_get_toplevel
(playlist))), NULL); */
-}
-
-static void
totem_playlist_error (char *title, char *reason, TotemPlaylist *playlist)
{
GtkWidget *error_dialog;
@@ -1365,7 +1346,7 @@ add_mrl_cb (TotemPlParser *parser, GAsyncResult *result, AddMrlData *data)
/* Remove the cursor, if one was set */
if (data->cursor)
- unset_waiting_cursor (data->playlist);
+ g_application_unmark_busy (g_application_get_default ());
/* Create an async result which will return the result to the code which called
totem_playlist_add_mrl() */
if (error != NULL)
@@ -1394,7 +1375,7 @@ totem_playlist_add_mrl (TotemPlaylist *playlist, const char *mrl, const char *di
/* Display a waiting cursor if required */
if (cursor)
- set_waiting_cursor (playlist);
+ g_application_mark_busy (g_application_get_default ());
/* Build the data struct to pass to the callback function */
data = g_slice_new (AddMrlData);
@@ -1485,7 +1466,7 @@ add_mrls_operation_data_free (AddMrlsOperationData *data)
{
/* Remove the cursor, if one was set */
if (data->cursor)
- unset_waiting_cursor (data->playlist);
+ g_application_unmark_busy (g_application_get_default ());
g_list_free_full (data->mrls, (GDestroyNotify) totem_playlist_mrl_data_free);
g_object_unref (data->playlist);
@@ -1666,7 +1647,7 @@ totem_playlist_add_mrls (TotemPlaylist *self,
/* Display a waiting cursor if required */
if (cursor)
- set_waiting_cursor (self);
+ g_application_mark_busy (g_application_get_default ());
for (i = mrls; i != NULL; i = i->next) {
TotemPlaylistMrlData *mrl_data = (TotemPlaylistMrlData*) i->data;
diff --git a/src/totem.c b/src/totem.c
index 8f02971..3329a29 100644
--- a/src/totem.c
+++ b/src/totem.c
@@ -132,7 +132,7 @@ app_init (Totem *totem, char **argv)
/* Show ! */
if (optionstate.fullscreen == FALSE) {
gtk_widget_show (totem->win);
- totem_gdk_window_set_waiting_cursor (gtk_widget_get_window (totem->win));
+ g_application_mark_busy (G_APPLICATION (totem));
} else {
gtk_widget_realize (totem->win);
}
@@ -178,7 +178,7 @@ app_init (Totem *totem, char **argv)
bacon_video_widget_set_logo (totem->bvw, "totem");
if (optionstate.fullscreen == FALSE)
- gdk_window_set_cursor (gtk_widget_get_window (totem->win), NULL);
+ g_application_unmark_busy (G_APPLICATION (totem));
gtk_window_set_application (GTK_WINDOW (totem->win), GTK_APPLICATION (totem));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]