[gnome-packagekit] Make some optimisations spotted by clang



commit 4504f2bf4efe19b8182982be9d24de8c3057800d
Author: Richard Hughes <richard hughsie com>
Date:   Mon Sep 7 10:16:48 2009 +0100

    Make some optimisations spotted by clang

 src/gpk-application.c   |   10 ----------
 src/gpk-helper-run.c    |    2 +-
 src/gpk-log.c           |    7 -------
 src/gpk-update-viewer.c |    5 ++---
 4 files changed, 3 insertions(+), 21 deletions(-)
---
diff --git a/src/gpk-application.c b/src/gpk-application.c
index 9ea65ab..0f000d2 100644
--- a/src/gpk-application.c
+++ b/src/gpk-application.c
@@ -2082,10 +2082,8 @@ gpk_application_packages_add_columns (GpkApplication *application)
 	GtkCellRenderer *renderer;
 	GtkTreeViewColumn *column;
 	GtkTreeView *treeview;
-	GtkTreeModel *model;
 
 	treeview = GTK_TREE_VIEW (gtk_builder_get_object (application->priv->builder, "treeview_packages"));
-	model = gtk_tree_view_get_model (treeview);
 
 	/* column for installed toggles */
 	renderer = gtk_cell_renderer_toggle_new ();
@@ -2147,7 +2145,6 @@ gpk_application_groups_treeview_changed_cb (GtkTreeSelection *selection, GpkAppl
 	GtkTreeModel *model;
 	GtkTreeIter iter;
 	GtkEntry *entry;
-	GtkTreeView *treeview;
 	GtkTreePath *path;
 	gboolean active;
 
@@ -2171,7 +2168,6 @@ gpk_application_groups_treeview_changed_cb (GtkTreeSelection *selection, GpkAppl
 
 		/* don't search parent groups */
 		if (!active) {
-			treeview = GTK_TREE_VIEW (gtk_builder_get_object (application->priv->builder, "treeview_detail"));
 			path = gtk_tree_model_get_path (model, &iter);
 
 			/* select the parent group */
@@ -2367,7 +2363,6 @@ gpk_application_popup_position_menu (GtkMenu *menu, gint *x, gint *y, gboolean *
 static void
 gpk_application_menu_search_by_name (GtkMenuItem *item, gpointer data)
 {
-	GtkWidget *icon;
 	GtkWidget *widget;
 	GpkApplication *application = GPK_APPLICATION (data);
 
@@ -2382,7 +2377,6 @@ gpk_application_menu_search_by_name (GtkMenuItem *item, gpointer data)
 	widget = GTK_WIDGET (gtk_builder_get_object (application->priv->builder, "entry_text"));
 	/* TRANSLATORS: entry tooltip: basic search */
 	gtk_widget_set_tooltip_text (widget, _("Searching by name"));
-	icon = gtk_image_new_from_stock (GTK_STOCK_FIND, GTK_ICON_SIZE_MENU);
 	gtk_entry_set_icon_from_stock (GTK_ENTRY (widget), GTK_ENTRY_ICON_PRIMARY, GTK_STOCK_FIND);
 }
 
@@ -2392,7 +2386,6 @@ gpk_application_menu_search_by_name (GtkMenuItem *item, gpointer data)
 static void
 gpk_application_menu_search_by_description (GtkMenuItem *item, gpointer data)
 {
-	GtkWidget *icon;
 	GtkWidget *widget;
 	GpkApplication *application = GPK_APPLICATION (data);
 
@@ -2407,7 +2400,6 @@ gpk_application_menu_search_by_description (GtkMenuItem *item, gpointer data)
 	widget = GTK_WIDGET (gtk_builder_get_object (application->priv->builder, "entry_text"));
 	/* TRANSLATORS: entry tooltip: detailed search */
 	gtk_widget_set_tooltip_text (widget, _("Searching by description"));
-	icon = gtk_image_new_from_stock (GTK_STOCK_EDIT, GTK_ICON_SIZE_MENU);
 	gtk_entry_set_icon_from_stock (GTK_ENTRY (widget), GTK_ENTRY_ICON_PRIMARY, GTK_STOCK_EDIT);
 }
 
@@ -2417,7 +2409,6 @@ gpk_application_menu_search_by_description (GtkMenuItem *item, gpointer data)
 static void
 gpk_application_menu_search_by_file (GtkMenuItem *item, gpointer data)
 {
-	GtkWidget *icon;
 	GtkWidget *widget;
 	GpkApplication *application = GPK_APPLICATION (data);
 
@@ -2432,7 +2423,6 @@ gpk_application_menu_search_by_file (GtkMenuItem *item, gpointer data)
 	widget = GTK_WIDGET (gtk_builder_get_object (application->priv->builder, "entry_text"));
 	/* TRANSLATORS: entry tooltip: file search */
 	gtk_widget_set_tooltip_text (widget, _("Searching by file"));
-	icon = gtk_image_new_from_stock (GTK_STOCK_OPEN, GTK_ICON_SIZE_MENU);
 	gtk_entry_set_icon_from_stock (GTK_ENTRY (widget), GTK_ENTRY_ICON_PRIMARY, GTK_STOCK_OPEN);
 }
 
diff --git a/src/gpk-helper-run.c b/src/gpk-helper-run.c
index 97a98eb..e9bed02 100644
--- a/src/gpk-helper-run.c
+++ b/src/gpk-helper-run.c
@@ -211,7 +211,7 @@ gpk_helper_run_add_desktop_file (GpkHelperRun *helper, const gchar *package_id,
 	gchar *joint = NULL;
 	gchar *menu_path = NULL;
 	GtkTreeIter iter;
-	GKeyFile *file;
+	GKeyFile *file = NULL;
 	PkPackageId *id;
 	gint weight;
 	gboolean hidden;
diff --git a/src/gpk-log.c b/src/gpk-log.c
index c66660e..e6880d5 100644
--- a/src/gpk-log.c
+++ b/src/gpk-log.c
@@ -633,8 +633,6 @@ main (int argc, char *argv[])
 	GtkWidget *widget;
 	GtkTreeSelection *selection;
 	GtkEntryCompletion *completion;
-	PkBitfield roles;
-	PkControl *control;
 	UniqueApp *unique_app;
 	gboolean ret;
 	guint retval;
@@ -696,11 +694,6 @@ main (int argc, char *argv[])
 	pk_client_set_use_buffer (client, TRUE, NULL);
 	pk_client_set_synchronous (client, TRUE, NULL);
 
-	/* get actions */
-	control = pk_control_new ();
-	roles = pk_control_get_actions (control, NULL);
-	g_object_unref (control);
-
 	/* get UI */
 	builder = gtk_builder_new ();
 	retval = gtk_builder_add_from_file (builder, GPK_DATA "/gpk-log.ui", &error);
diff --git a/src/gpk-update-viewer.c b/src/gpk-update-viewer.c
index 74fed2c..240dcbc 100644
--- a/src/gpk-update-viewer.c
+++ b/src/gpk-update-viewer.c
@@ -583,7 +583,6 @@ gpk_update_viewer_package_cb (PkClient *client, const PkPackageObj *obj, gpointe
 	GtkTreeIter iter;
 	GtkTreeModel *model;
 	GtkTreeViewColumn *column;
-	GtkWidget *widget;
 	GtkTreePath *path;
 	gboolean selected;
 	gboolean scroll;
@@ -649,7 +648,7 @@ gpk_update_viewer_package_cb (PkClient *client, const PkPackageObj *obj, gpointe
 		gtk_tree_path_free (path);
 
 		/* set package description */
-		widget = GTK_WIDGET (gtk_builder_get_object (builder, "label_package"));
+		//widget = GTK_WIDGET (gtk_builder_get_object (builder, "label_package"));
 		//gtk_label_set_label (GTK_LABEL (widget), obj->summary);
 
 		goto out;
@@ -2262,7 +2261,7 @@ gpk_update_viewer_get_checked_status (gboolean *all_checked, gboolean *none_chec
 	GtkTreeView *treeview;
 	gboolean valid;
 	gboolean update;
-	gboolean clickable;
+	gboolean clickable = FALSE;
 	GtkTreeIter iter;
 	GtkTreeModel *model;
 



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