[totem] gcc warning fixes in Totem



commit 81403ff7d040c10e4edbf17aadfff9599da97e5d
Author: Philip Withnall <philip tecnocode co uk>
Date:   Thu Jul 15 23:24:02 2010 +0100

    gcc warning fixes in Totem
    
    Constness problems, shadowing and missing cases in switch statements.

 src/totem-object.c   |    9 ++++++---
 src/totem-options.c  |    2 +-
 src/totem-playlist.c |    1 +
 src/totem.c          |   32 +++++---------------------------
 4 files changed, 13 insertions(+), 31 deletions(-)
---
diff --git a/src/totem-object.c b/src/totem-object.c
index 5bfbaf2..ba8e31e 100644
--- a/src/totem-object.c
+++ b/src/totem-object.c
@@ -1191,7 +1191,7 @@ totem_action_load_media (TotemObject *totem, TotemDiscMediaType type, const char
 {
 	char **mrls;
 	GError *error = NULL;
-	const char *link, *link_text, *secondary;
+	const char *uri, *link_text, *secondary;
 	gboolean retval;
 
 	mrls = bacon_video_widget_get_mrls (totem->bvw, type, device, &error);
@@ -1208,7 +1208,7 @@ totem_action_load_media (TotemObject *totem, TotemDiscMediaType type, const char
 
 		/* No plugin for the media type */
 		if (g_error_matches (error, BVW_ERROR, BVW_ERROR_NO_PLUGIN_FOR_FILE) != FALSE) {
-			link = "http://projects.gnome.org/totem/#codecs";;
+			uri = "http://projects.gnome.org/totem/#codecs";;
 			link_text = _("More information about media plugins");
 			secondary = _("Please install the necessary plugins and restart Totem to be able to play this media.");
 			if (type == MEDIA_TYPE_DVD || type == MEDIA_TYPE_VCD)
@@ -1225,7 +1225,7 @@ totem_action_load_media (TotemObject *totem, TotemDiscMediaType type, const char
 			g_assert_not_reached ();
 		}
 
-		totem_interface_error_with_link (msg, secondary, link, link_text, GTK_WINDOW (totem->win));
+		totem_interface_error_with_link (msg, secondary, uri, link_text, GTK_WINDOW (totem->win));
 		g_free (msg);
 		return FALSE;
 	}
@@ -1273,6 +1273,7 @@ totem_action_load_media_device (TotemObject *totem, const char *device)
 					    _("Please consider using a music player or a CD extractor to play this CD"));
 			retval = FALSE;
 			break;
+		case MEDIA_TYPE_DVB:
 		default:
 			g_assert_not_reached ();
 	}
@@ -3758,6 +3759,8 @@ totem_action_handle_scroll (TotemObject *totem, GdkScrollDirection direction)
 	case GDK_SCROLL_DOWN:
 		totem_action_seek_relative (totem, SEEK_BACKWARD_SHORT_OFFSET * 1000, FALSE);
 		break;
+	case GDK_SCROLL_LEFT:
+	case GDK_SCROLL_RIGHT:
 	default:
 		retval = FALSE;
 	}
diff --git a/src/totem-options.c b/src/totem-options.c
index 38387ab..86df80b 100644
--- a/src/totem-options.c
+++ b/src/totem-options.c
@@ -91,7 +91,7 @@ totem_options_register_remote_commands (Totem *totem)
 
 	klass = (GEnumClass *) g_type_class_ref (TOTEM_TYPE_REMOTE_COMMAND);
 	for (i = TOTEM_REMOTE_COMMAND_UNKNOWN + 1; i < klass->n_values; i++) {
-		GEnumValue *val = g_enum_get_value (klass, i);
+		const GEnumValue *val = g_enum_get_value (klass, i);
 		g_application_add_action (G_APPLICATION (totem->app), val->value_name, val->value_nick);
 	}
 	g_type_class_unref (klass);
diff --git a/src/totem-playlist.c b/src/totem-playlist.c
index 9998eed..b2eed50 100644
--- a/src/totem-playlist.c
+++ b/src/totem-playlist.c
@@ -1252,6 +1252,7 @@ set_playing_icon (GtkTreeViewColumn *column, GtkCellRenderer *renderer,
 		case TOTEM_PLAYLIST_STATUS_PAUSED:
 			icon_name = "media-playback-pause-symbolic";
 			break;
+		case TOTEM_PLAYLIST_STATUS_NONE:
 		default:
 			icon_name = NULL;
 	}
diff --git a/src/totem.c b/src/totem.c
index b308835..af267de 100644
--- a/src/totem.c
+++ b/src/totem.c
@@ -65,7 +65,7 @@ totem_action_handler (GApplication      *app,
 		      gpointer           user_data)
 {
 	GEnumClass *klass;
-	GEnumValue *enum_value;
+	const GEnumValue *enum_value;
 	char *url = NULL;
 	TotemRemoteCommand command;
 
@@ -101,13 +101,13 @@ totem_action_handler (GApplication      *app,
 
 static void
 about_url_hook (GtkAboutDialog *about,
-	        const char *link,
+	        const char *uri,
 	        gpointer user_data)
 {
 	GError *error = NULL;
 
 	if (!gtk_show_uri (gtk_widget_get_screen (GTK_WIDGET (about)),
-	                   link,
+	                   uri,
 	                   gtk_get_current_event_time (),
 	                   &error))
 	{
@@ -151,26 +151,6 @@ debug_handler (const char *log_domain,
 		g_log_default_handler (log_domain, log_level, message, NULL);
 }
 
-static GVariant *
-variant_from_argv (int    argc,
-		   char **argv)
-{
-	GVariantBuilder builder;
-	int i;
-
-	g_variant_builder_init (&builder, G_VARIANT_TYPE("aay"));
-
-	for (i = 1; i < argc; i++) {
-		guint8 *argv_bytes;
-
-		argv_bytes = (guint8 *) argv[i];
-		g_variant_builder_add_value (&builder,
-					     g_variant_new_bytestring_array (argv_bytes, -1));
-	}
-
-	return g_variant_builder_end (&builder);
-}
-
 int
 main (int argc, char **argv)
 {
@@ -240,14 +220,12 @@ main (int argc, char **argv)
 
 	/* IPC stuff */
 	if (optionstate.notconnectexistingsession == FALSE) {
-		GError *error = NULL;
-
 		/* FIXME should be GtkApplication */
 		totem->app = g_initable_new (G_TYPE_APPLICATION,
 					     NULL,
-					     &error,
+					     NULL,
 					     "application-id", "org.gnome.Totem",
-					     "argv", variant_from_argv (argc, argv),
+					     "argv", g_variant_new_bytestring_array ((const gchar * const*) argv, argc),
 					     "default-quit", FALSE,
 					     NULL);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]