gnome-packagekit r498 - in trunk: . src



Author: rhughes
Date: Tue Feb 24 22:28:28 2009
New Revision: 498
URL: http://svn.gnome.org/viewvc/gnome-packagekit?rev=498&view=rev

Log:
from git

Added:
   trunk/src/gpk-cell-renderer-info.c
   trunk/src/gpk-cell-renderer-info.h
   trunk/src/gpk-cell-renderer-percentage.c
   trunk/src/gpk-cell-renderer-percentage.h
Modified:
   trunk/configure.ac
   trunk/src/gpk-animated-icon.c
   trunk/src/gpk-animated-icon.h
   trunk/src/gpk-common.c
   trunk/src/gpk-enum.c

Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac	(original)
+++ trunk/configure.ac	Tue Feb 24 22:28:28 2009
@@ -38,7 +38,7 @@
 #	CPPFLAGS="$CPPFLAGS -Wmissing-declarations"
 	CPPFLAGS="$CPPFLAGS -Wno-uninitialized"
 	CPPFLAGS="$CPPFLAGS -Wredundant-decls"
-	CPPFLAGS="$CPPFLAGS -Wmissing-noreturn"
+#	CPPFLAGS="$CPPFLAGS -Wmissing-noreturn"
 	CPPFLAGS="$CPPFLAGS -Wshadow"
 	CPPFLAGS="$CPPFLAGS -Wpointer-arith"
 	CPPFLAGS="$CPPFLAGS -Wcast-align"

Modified: trunk/src/gpk-animated-icon.c
==============================================================================
--- trunk/src/gpk-animated-icon.c	(original)
+++ trunk/src/gpk-animated-icon.c	Tue Feb 24 22:28:28 2009
@@ -60,6 +60,23 @@
 }
 
 /**
+ * gpk_animated_icon_set_icon_name:
+ **/
+gboolean
+gpk_animated_icon_set_icon_name (GpkAnimatedIcon *icon, GtkIconSize size, const gchar *name)
+{
+	g_return_val_if_fail (GPK_IS_ANIMATED_ICON (icon), FALSE);
+	g_return_val_if_fail (name != NULL, FALSE);
+
+	/* stop existing animation */
+	gpk_animated_icon_enable_animation (icon, FALSE);
+
+	/* set static image */
+	gtk_image_set_from_icon_name (GTK_IMAGE (icon), name, size);
+	return TRUE;
+}
+
+/**
  * gpk_animated_icon_set_filename_tile:
  **/
 gboolean
@@ -119,6 +136,9 @@
 
 	g_object_unref (pixbuf);
 
+	/* enable new animation */
+	gpk_animated_icon_enable_animation (icon, TRUE);
+
 	return TRUE;
 }
 

Modified: trunk/src/gpk-animated-icon.h
==============================================================================
--- trunk/src/gpk-animated-icon.h	(original)
+++ trunk/src/gpk-animated-icon.h	Tue Feb 24 22:28:28 2009
@@ -58,6 +58,9 @@
 gboolean	 gpk_animated_icon_set_filename_tile	(GpkAnimatedIcon	*icon,
 							 GtkIconSize		 size,
 							 const gchar		*name);
+gboolean	 gpk_animated_icon_set_icon_name	(GpkAnimatedIcon	*icon,
+							 GtkIconSize		 size,
+							 const gchar		*name);
 gboolean	 gpk_animated_icon_set_frame_delay	(GpkAnimatedIcon	*icon,
 							 guint			 delay_ms);
 gboolean	 gpk_animated_icon_enable_animation	(GpkAnimatedIcon	*icon,

Added: trunk/src/gpk-cell-renderer-info.c
==============================================================================
--- (empty file)
+++ trunk/src/gpk-cell-renderer-info.c	Tue Feb 24 22:28:28 2009
@@ -0,0 +1,126 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2008-2009 Richard Hughes <richard hughsie com>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "config.h"
+
+#include <glib.h>
+#include <glib/gi18n.h>
+#include <gtk/gtk.h>
+#include <packagekit-glib/packagekit.h>
+
+#include "egg-debug.h"
+
+#include "gpk-enum.h"
+#include "gpk-cell-renderer-info.h"
+
+enum {
+	PROP_0,
+	PROP_VALUE
+};
+
+G_DEFINE_TYPE (GpkCellRendererInfo, gpk_cell_renderer_info, GTK_TYPE_CELL_RENDERER_PIXBUF)
+
+static gpointer parent_class = NULL;
+
+static void
+gpk_cell_renderer_info_get_property (GObject *object, guint param_id,
+				        GValue *value, GParamSpec *pspec)
+{
+	GpkCellRendererInfo *cru = GPK_CELL_RENDERER_INFO (object);
+
+	switch (param_id) {
+	case PROP_VALUE:
+		g_value_set_uint (value, cru->value);
+		break;
+	default:
+		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
+		break;
+	}
+}
+
+static void
+gpk_cell_renderer_info_set_property (GObject *object, guint param_id,
+				    const GValue *value, GParamSpec *pspec)
+{
+	GpkCellRendererInfo *cru = GPK_CELL_RENDERER_INFO (object);
+
+	switch (param_id) {
+	case PROP_VALUE:
+		cru->value = g_value_get_uint (value);
+		cru->icon_name = gpk_info_enum_to_icon_name (cru->value);
+		g_object_set (cru, "icon-name", cru->icon_name, NULL);
+		break;
+	default:
+		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
+		break;
+	}
+}
+
+/**
+ * gpk_cell_renderer_finalize:
+ * @object: The object to finalize
+ **/
+static void
+gpk_cell_renderer_finalize (GObject *object)
+{
+	GpkCellRendererInfo *cru;
+	cru = GPK_CELL_RENDERER_INFO (object);
+	G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+gpk_cell_renderer_info_class_init (GpkCellRendererInfoClass *class)
+{
+	GtkCellRendererClass *cell_renderer_class;
+	GObjectClass *object_class = G_OBJECT_CLASS (class);
+	object_class->finalize = gpk_cell_renderer_finalize;
+
+	parent_class = g_type_class_peek_parent (class);
+
+	cell_renderer_class = GTK_CELL_RENDERER_CLASS (class);
+
+	object_class->get_property = gpk_cell_renderer_info_get_property;
+	object_class->set_property = gpk_cell_renderer_info_set_property;
+
+	g_object_class_install_property (object_class, PROP_VALUE,
+					 g_param_spec_uint ("value", "VALUE",
+					 "VALUE", 0, G_MAXUINT, PK_INFO_ENUM_UNKNOWN, G_PARAM_READWRITE));
+}
+
+/**
+ * gpk_cell_renderer_info_init:
+ **/
+static void
+gpk_cell_renderer_info_init (GpkCellRendererInfo *cru)
+{
+	cru->value = PK_INFO_ENUM_UNKNOWN;
+	cru->icon_name = NULL;
+}
+
+/**
+ * gpk_cell_renderer_info_new:
+ **/
+GtkCellRenderer *
+gpk_cell_renderer_info_new (void)
+{
+	return g_object_new (GPK_TYPE_CELL_RENDERER_INFO, NULL);
+}
+

Added: trunk/src/gpk-cell-renderer-info.h
==============================================================================
--- (empty file)
+++ trunk/src/gpk-cell-renderer-info.h	Tue Feb 24 22:28:28 2009
@@ -0,0 +1,59 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2008-2009 Richard Hughes <richard hughsie com>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef GPK_CELL_RENDERER_INFO_H
+#define GPK_CELL_RENDERER_INFO_H
+
+#include <glib-object.h>
+#include <gtk/gtk.h>
+#include <packagekit-glib/packagekit.h>
+
+#define GPK_TYPE_CELL_RENDERER_INFO		(gpk_cell_renderer_info_get_type())
+#define GPK_CELL_RENDERER_INFO(obj)		(G_TYPE_CHECK_INSTANCE_CAST((obj), GPK_TYPE_CELL_RENDERER_INFO, GpkCellRendererInfo))
+#define GPK_CELL_RENDERER_INFO_CLASS(cls)	(G_TYPE_CHECK_CLASS_CAST((cls), GPK_TYPE_CELL_RENDERER_INFO, GpkCellRendererInfoClass))
+#define GPK_IS_CELL_RENDERER_INFO(obj)		(G_TYPE_CHECK_INSTANCE_TYPE((obj), GPK_TYPE_CELL_RENDERER_INFO))
+#define GPK_IS_CELL_RENDERER_INFO_CLASS(cls)	(G_TYPE_CHECK_CLASS_TYPE((cls), GPK_TYPE_CELL_RENDERER_INFO))
+#define GPK_CELL_RENDERER_INFO_GET_CLASS(obj)	(G_TYPE_INSTANCE_GET_CLASS((obj), GPK_TYPE_CELL_RENDERER_INFO, GpkCellRendererInfoClass))
+
+G_BEGIN_DECLS
+
+typedef struct _GpkCellRendererInfo		GpkCellRendererInfo;
+typedef struct _GpkCellRendererInfoClass	GpkCellRendererInfoClass;
+
+struct _GpkCellRendererInfo
+{
+	GtkCellRendererPixbuf	 parent;
+	PkInfoEnum		 value;
+	const gchar		*icon_name;
+};
+
+struct _GpkCellRendererInfoClass
+{
+	GtkCellRendererPixbufClass parent_class;
+};
+
+GType		 gpk_cell_renderer_info_get_type	(void);
+GtkCellRenderer	*gpk_cell_renderer_info_new		(void);
+
+G_END_DECLS
+
+#endif /* GPK_CELL_RENDERER_INFO_H */
+

Added: trunk/src/gpk-cell-renderer-percentage.c
==============================================================================
--- (empty file)
+++ trunk/src/gpk-cell-renderer-percentage.c	Tue Feb 24 22:28:28 2009
@@ -0,0 +1,136 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2008-2009 Richard Hughes <richard hughsie com>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "config.h"
+
+#include <glib.h>
+#include <glib/gi18n.h>
+#include <gtk/gtk.h>
+#include <packagekit-glib/packagekit.h>
+
+#include "egg-debug.h"
+
+#include "gpk-enum.h"
+#include "gpk-cell-renderer-percentage.h"
+
+enum {
+	PROP_0,
+	PROP_PERCENT
+};
+
+G_DEFINE_TYPE (GpkCellRendererPercentage, gpk_cell_renderer_percentage, GTK_TYPE_CELL_RENDERER_PROGRESS)
+
+static gpointer parent_class = NULL;
+
+static void
+gpk_cell_renderer_percentage_get_property (GObject *object, guint param_id,
+				        GValue *value, GParamSpec *pspec)
+{
+	GpkCellRendererPercentage *cru = GPK_CELL_RENDERER_PERCENTAGE (object);
+
+	switch (param_id) {
+	case PROP_PERCENT:
+		g_value_set_uint (value, cru->percent);
+		break;
+	default:
+		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
+		break;
+	}
+}
+
+static void
+gpk_cell_renderer_percentage_set_property (GObject *object, guint param_id,
+				    const GValue *value, GParamSpec *pspec)
+{
+	GpkCellRendererPercentage *cru = GPK_CELL_RENDERER_PERCENTAGE (object);
+
+	switch (param_id) {
+	case PROP_PERCENT:
+		cru->percent = g_value_get_uint (value);
+		if (cru->percent == 0) {
+			g_object_set (cru, "pulse", -1, NULL);
+			g_object_set (cru, "visible", FALSE, NULL);
+		} else if (cru->percent == 101) {
+			g_object_set (cru, "pulse", 1, NULL);
+			g_object_set (cru, "visible", TRUE, NULL);
+		} else {
+			g_object_set (cru, "visible", TRUE, NULL);
+			g_object_set (cru, "pulse", -1, NULL);
+			g_object_set (cru, "value", cru->percent, NULL);
+		}
+		break;
+	default:
+		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
+		break;
+	}
+}
+
+/**
+ * gpk_cell_renderer_finalize:
+ * @object: The object to finalize
+ **/
+static void
+gpk_cell_renderer_finalize (GObject *object)
+{
+	GpkCellRendererPercentage *cru;
+	cru = GPK_CELL_RENDERER_PERCENTAGE (object);
+	G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+gpk_cell_renderer_percentage_class_init (GpkCellRendererPercentageClass *class)
+{
+	GtkCellRendererClass *cell_renderer_class;
+	GObjectClass *object_class = G_OBJECT_CLASS (class);
+	object_class->finalize = gpk_cell_renderer_finalize;
+
+	parent_class = g_type_class_peek_parent (class);
+
+	cell_renderer_class = GTK_CELL_RENDERER_CLASS (class);
+
+	object_class->get_property = gpk_cell_renderer_percentage_get_property;
+	object_class->set_property = gpk_cell_renderer_percentage_set_property;
+
+	g_object_class_install_property (object_class, PROP_PERCENT,
+					 g_param_spec_uint ("percent", "PERCENT",
+					 "PERCENT", 0, G_MAXUINT, 0, G_PARAM_READWRITE));
+}
+
+/**
+ * gpk_cell_renderer_percentage_init:
+ **/
+static void
+gpk_cell_renderer_percentage_init (GpkCellRendererPercentage *cru)
+{
+	cru->percent = 0;
+	g_object_set (cru, "text", "", NULL);
+	g_object_set (cru, "ypad", 6, NULL);
+}
+
+/**
+ * gpk_cell_renderer_percentage_new:
+ **/
+GtkCellRenderer *
+gpk_cell_renderer_percentage_new (void)
+{
+	return g_object_new (GPK_TYPE_CELL_RENDERER_PERCENTAGE, NULL);
+}
+

Added: trunk/src/gpk-cell-renderer-percentage.h
==============================================================================
--- (empty file)
+++ trunk/src/gpk-cell-renderer-percentage.h	Tue Feb 24 22:28:28 2009
@@ -0,0 +1,57 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2008-2009 Richard Hughes <richard hughsie com>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef GPK_CELL_RENDERER_PERCENTAGE_H
+#define GPK_CELL_RENDERER_PERCENTAGE_H
+
+#include <glib-object.h>
+#include <gtk/gtk.h>
+
+#define GPK_TYPE_CELL_RENDERER_PERCENTAGE		(gpk_cell_renderer_percentage_get_type())
+#define GPK_CELL_RENDERER_PERCENTAGE(obj)		(G_TYPE_CHECK_INSTANCE_CAST((obj), GPK_TYPE_CELL_RENDERER_PERCENTAGE, GpkCellRendererPercentage))
+#define GPK_CELL_RENDERER_PERCENTAGE_CLASS(cls)		(G_TYPE_CHECK_CLASS_CAST((cls), GPK_TYPE_CELL_RENDERER_PERCENTAGE, GpkCellRendererPercentageClass))
+#define GPK_IS_CELL_RENDERER_PERCENTAGE(obj)		(G_TYPE_CHECK_INSTANCE_TYPE((obj), GPK_TYPE_CELL_RENDERER_PERCENTAGE))
+#define GPK_IS_CELL_RENDERER_PERCENTAGE_CLASS(cls)	(G_TYPE_CHECK_CLASS_TYPE((cls), GPK_TYPE_CELL_RENDERER_PERCENTAGE))
+#define GPK_CELL_RENDERER_PERCENTAGE_GET_CLASS(obj)	(G_TYPE_INSTANCE_GET_CLASS((obj), GPK_TYPE_CELL_RENDERER_PERCENTAGE, GpkCellRendererPercentageClass))
+
+G_BEGIN_DECLS
+
+typedef struct _GpkCellRendererPercentage	GpkCellRendererPercentage;
+typedef struct _GpkCellRendererPercentageClass	GpkCellRendererPercentageClass;
+
+struct _GpkCellRendererPercentage
+{
+	GtkCellRendererProgress	 parent;
+	guint			 percent;
+};
+
+struct _GpkCellRendererPercentageClass
+{
+	GtkCellRendererProgressClass parent_class;
+};
+
+GType		 gpk_cell_renderer_percentage_get_type	(void);
+GtkCellRenderer	*gpk_cell_renderer_percentage_new	(void);
+
+G_END_DECLS
+
+#endif /* GPK_CELL_RENDERER_PERCENTAGE_H */
+

Modified: trunk/src/gpk-common.c
==============================================================================
--- trunk/src/gpk-common.c	(original)
+++ trunk/src/gpk-common.c	Tue Feb 24 22:28:28 2009
@@ -337,10 +337,8 @@
 	if (delay != 0) {
 		gpk_animated_icon_set_frame_delay (icon, delay);
 		gpk_animated_icon_set_filename_tile (icon, size, name);
-		gpk_animated_icon_enable_animation (icon, TRUE);
 	} else {
-		gpk_animated_icon_enable_animation (icon, FALSE);
-		gtk_image_set_from_icon_name (GTK_IMAGE (icon), name, size);
+		gpk_animated_icon_set_icon_name (icon, size, name);
 	}
 
 	/* stop spinning */

Modified: trunk/src/gpk-enum.c
==============================================================================
--- trunk/src/gpk-enum.c	(original)
+++ trunk/src/gpk-enum.c	Tue Feb 24 22:28:28 2009
@@ -51,6 +51,7 @@
 	{PK_INFO_ENUM_CLEANUP,			"pk-package-cleanup"},
 	{PK_INFO_ENUM_COLLECTION_INSTALLED,	"pk-collection-installed"},
 	{PK_INFO_ENUM_COLLECTION_AVAILABLE,	"pk-collection-available"},
+	{PK_INFO_ENUM_FINISHED,			"dialog-information"},
 	{0, NULL}
 };
 
@@ -203,9 +204,9 @@
 static const PkEnumMatch enum_restart_icon_name[] = {
 	{PK_RESTART_ENUM_UNKNOWN,		"help-browser"},	/* fall though value */
 	{PK_RESTART_ENUM_NONE,			""},
-	{PK_RESTART_ENUM_SYSTEM,		"view-refresh"},
-	{PK_RESTART_ENUM_SESSION,		"view-refresh"},
-	{PK_RESTART_ENUM_APPLICATION,		"view-refresh"},
+	{PK_RESTART_ENUM_SYSTEM,		"computer"},
+	{PK_RESTART_ENUM_SESSION,		"preferences-system-session"},
+	{PK_RESTART_ENUM_APPLICATION,		"emblem-symbolic-link"},
 	{0, NULL}
 };
 



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