gnome-packagekit r521 - in trunk: data src



Author: rhughes
Date: Mon Mar 23 09:45:49 2009
New Revision: 521
URL: http://svn.gnome.org/viewvc/gnome-packagekit?rev=521&view=rev

Log:
rename two files

Added:
   trunk/src/gpk-helper-eula.c
   trunk/src/gpk-helper-eula.h
   trunk/src/gpk-helper-repo-signature.c
   trunk/src/gpk-helper-repo-signature.h
Removed:
   trunk/src/gpk-eula-helper.c
   trunk/src/gpk-eula-helper.h
   trunk/src/gpk-repo-signature-helper.c
   trunk/src/gpk-repo-signature-helper.h
Modified:
   trunk/data/gpk-update-viewer2.glade
   trunk/src/Makefile.am
   trunk/src/gpk-check-update.c
   trunk/src/gpk-update-viewer.c
   trunk/src/gpk-update-viewer2.c

Modified: trunk/data/gpk-update-viewer2.glade
==============================================================================
--- trunk/data/gpk-update-viewer2.glade	(original)
+++ trunk/data/gpk-update-viewer2.glade	Mon Mar 23 09:45:49 2009
@@ -234,7 +234,7 @@
                     <child>
                       <widget class="GtkLabel" id="label_status">
                         <property name="visible">True</property>
-                        <property name="label" translatable="yes">&lt;b&gt;Downloading:&lt;/b&gt;</property>
+                        <property name="label">&lt;b&gt;Downloading:&lt;/b&gt;</property>
                         <property name="use_markup">True</property>
                       </widget>
                       <packing>
@@ -245,7 +245,7 @@
                     <child>
                       <widget class="GtkLabel" id="label_package">
                         <property name="visible">True</property>
-                        <property name="label" translatable="yes">data</property>
+                        <property name="label">data</property>
                         <property name="use_markup">True</property>
                       </widget>
                       <packing>
@@ -253,19 +253,6 @@
                         <property name="position">3</property>
                       </packing>
                     </child>
-                    <child>
-                      <widget class="GtkLabel" id="label_summary">
-                        <property name="visible">True</property>
-                        <property name="label" translatable="yes">7 updates selected (45Mb)</property>
-                        <property name="use_markup">True</property>
-                        <property name="justify">right</property>
-                      </widget>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="pack_type">end</property>
-                        <property name="position">4</property>
-                      </packing>
-                    </child>
                   </widget>
                   <packing>
                     <property name="expand">False</property>
@@ -299,6 +286,19 @@
                         <property name="position">1</property>
                       </packing>
                     </child>
+                    <child>
+                      <widget class="GtkLabel" id="label_summary">
+                        <property name="visible">True</property>
+                        <property name="label">7 updates selected (45Mb)</property>
+                        <property name="use_markup">True</property>
+                        <property name="justify">right</property>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="pack_type">end</property>
+                        <property name="position">2</property>
+                      </packing>
+                    </child>
                   </widget>
                   <packing>
                     <property name="expand">False</property>
@@ -350,7 +350,7 @@
             </child>
             <child>
               <widget class="GtkButton" id="button_shutdown">
-                <property name="label" translatable="yes">Shut down</property>
+                <property name="label" translatable="yes">Restart computer</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">True</property>
               </widget>

Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am	(original)
+++ trunk/src/Makefile.am	Mon Mar 23 09:45:49 2009
@@ -218,10 +218,10 @@
 
 gpk_update_viewer2_SOURCES =				\
 	gpk-update-viewer2.c				\
-	gpk-repo-signature-helper.c			\
-	gpk-repo-signature-helper.h			\
-	gpk-eula-helper.c				\
-	gpk-eula-helper.h				\
+	gpk-helper-repo-signature.c			\
+	gpk-helper-repo-signature.h			\
+	gpk-helper-eula.c				\
+	gpk-helper-eula.h				\
 	gpk-cell-renderer-uri.c				\
 	gpk-cell-renderer-uri.h				\
 	gpk-cell-renderer-size.c			\

Modified: trunk/src/gpk-check-update.c
==============================================================================
--- trunk/src/gpk-check-update.c	(original)
+++ trunk/src/gpk-check-update.c	Mon Mar 23 09:45:49 2009
@@ -869,7 +869,7 @@
  * gpk_check_update_updates_changed_cb:
  **/
 static void
-gpk_check_update_updates_changed_cb (PkClient *client, GpkCheckUpdate *cupdate)
+gpk_check_update_updates_changed_cb (PkControl *control, GpkCheckUpdate *cupdate)
 {
 	g_return_if_fail (GPK_IS_CHECK_UPDATE (cupdate));
 

Added: trunk/src/gpk-helper-eula.c
==============================================================================
--- (empty file)
+++ trunk/src/gpk-helper-eula.c	Mon Mar 23 09:45:49 2009
@@ -0,0 +1,233 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 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/gi18n.h>
+#include <gtk/gtk.h>
+#include <glade/glade.h>
+
+#include "gpk-helper-eula.h"
+#include "gpk-marshal.h"
+#include "gpk-gnome.h"
+#include "gpk-common.h"
+
+#include "egg-debug.h"
+
+static void     gpk_helper_eula_finalize	(GObject	  *object);
+
+#define GPK_HELPER_EULA_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GPK_TYPE_HELPER_EULA, GpkHelperEulaPrivate))
+
+struct GpkHelperEulaPrivate
+{
+	GladeXML		*glade_xml;
+	gchar			*eula_id;
+};
+
+enum {
+	GPK_HELPER_EULA_EVENT,
+	GPK_HELPER_EULA_LAST_SIGNAL
+};
+
+static guint signals [GPK_HELPER_EULA_LAST_SIGNAL] = { 0 };
+G_DEFINE_TYPE (GpkHelperEula, gpk_helper_eula, G_TYPE_OBJECT)
+
+/**
+ * gpk_helper_eula_button_agree_cb:
+ **/
+static void
+gpk_helper_eula_button_agree_cb (GtkWidget *widget, GpkHelperEula *helper)
+{
+	g_signal_emit (helper, signals [GPK_HELPER_EULA_EVENT], 0, GTK_RESPONSE_YES, helper->priv->eula_id);
+	widget = glade_xml_get_widget (helper->priv->glade_xml, "dialog_eula");
+	gtk_widget_hide (widget);
+}
+
+/**
+ * gpk_helper_eula_button_cancel_cb:
+ **/
+static void
+gpk_helper_eula_button_cancel_cb (GtkWidget *widget, GpkHelperEula *helper)
+{
+	g_signal_emit (helper, signals [GPK_HELPER_EULA_EVENT], 0, GTK_RESPONSE_NO, helper->priv->eula_id);
+	widget = glade_xml_get_widget (helper->priv->glade_xml, "dialog_eula");
+	gtk_widget_hide (widget);
+}
+
+/**
+ * gpk_helper_eula_button_help_cb:
+ **/
+static void
+gpk_helper_eula_button_help_cb (GtkWidget *widget, GpkHelperEula *helper)
+{
+	/* show the help */
+	gpk_gnome_help ("eula");
+}
+
+/**
+ * gpk_helper_eula_show:
+ *
+ * Return value: if we agreed
+ **/
+gboolean
+gpk_helper_eula_show (GpkHelperEula *helper, const gchar *eula_id, const gchar *package_id,
+	       const gchar *vendor_name, const gchar *license_agreement)
+{
+	GtkWidget *widget;
+	GtkTextBuffer *buffer;
+	gchar *text;
+	PkPackageId *ident;
+
+	g_return_val_if_fail (GPK_IS_HELPER_EULA (helper), FALSE);
+	g_return_val_if_fail (eula_id != NULL, FALSE);
+
+	/* cache */
+	g_free (helper->priv->eula_id);
+	helper->priv->eula_id = g_strdup (eula_id);
+
+	/* title */
+	widget = glade_xml_get_widget (helper->priv->glade_xml, "label_title");
+	ident = pk_package_id_new_from_string (package_id);
+	text = g_strdup_printf ("<b><big>License required for %s by %s</big></b>", ident->name, vendor_name);
+	gtk_label_set_label (GTK_LABEL (widget), text);
+	pk_package_id_free (ident);
+	g_free (text);
+
+	buffer = gtk_text_buffer_new (NULL);
+	gtk_text_buffer_insert_at_cursor (buffer, license_agreement, strlen (license_agreement));
+	widget = glade_xml_get_widget (helper->priv->glade_xml, "textview_details");
+	gtk_text_view_set_buffer (GTK_TEXT_VIEW (widget), buffer);
+
+	/* set minimum size a bit bigger */
+	gtk_widget_set_size_request (widget, 100, 200);
+
+	/* show window */
+	widget = glade_xml_get_widget (helper->priv->glade_xml, "dialog_eula");
+	gtk_widget_show (widget);
+
+	g_object_unref (buffer);
+
+	return TRUE;
+}
+
+/**
+ * gpk_helper_eula_set_parent:
+ **/
+gboolean
+gpk_helper_eula_set_parent (GpkHelperEula *helper, GtkWindow *window)
+{
+	GtkWidget *widget;
+
+	g_return_val_if_fail (GPK_IS_HELPER_EULA (helper), FALSE);
+	g_return_val_if_fail (window != NULL, FALSE);
+
+	/* make modal if window set */
+	widget = glade_xml_get_widget (helper->priv->glade_xml, "dialog_eula");
+	gtk_window_set_transient_for (GTK_WINDOW (widget), window);
+
+	/* this is a modal popup, so don't show a window title */
+	gtk_window_set_title (GTK_WINDOW (widget), "");
+
+	return TRUE;
+}
+
+/**
+ * gpk_helper_eula_class_init:
+ * @klass: The GpkHelperEulaClass
+ **/
+static void
+gpk_helper_eula_class_init (GpkHelperEulaClass *klass)
+{
+	GObjectClass *object_class = G_OBJECT_CLASS (klass);
+	object_class->finalize = gpk_helper_eula_finalize;
+	g_type_class_add_private (klass, sizeof (GpkHelperEulaPrivate));
+	signals [GPK_HELPER_EULA_EVENT] =
+		g_signal_new ("event",
+			      G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
+			      G_STRUCT_OFFSET (GpkHelperEulaClass, event),
+			      NULL, NULL, gpk_marshal_VOID__UINT_STRING,
+			      G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_STRING);
+}
+
+/**
+ * gpk_helper_eula_init:
+ **/
+static void
+gpk_helper_eula_init (GpkHelperEula *helper)
+{
+	GtkWidget *widget;
+
+	helper->priv = GPK_HELPER_EULA_GET_PRIVATE (helper);
+
+	helper->priv->eula_id = NULL;
+	helper->priv->glade_xml = glade_xml_new (GPK_DATA "/gpk-eula.glade", NULL, NULL);
+
+	/* connect up default actions */
+	widget = glade_xml_get_widget (helper->priv->glade_xml, "dialog_eula");
+	g_signal_connect (widget, "delete_event", G_CALLBACK (gpk_helper_eula_button_cancel_cb), helper);
+
+	/* set icon name */
+	widget = glade_xml_get_widget (helper->priv->glade_xml, "dialog_eula");
+	gtk_window_set_icon_name (GTK_WINDOW (widget), GPK_ICON_SOFTWARE_INSTALLER);
+
+	/* connect up buttons */
+	widget = glade_xml_get_widget (helper->priv->glade_xml, "button_agree");
+	g_signal_connect (widget, "clicked", G_CALLBACK (gpk_helper_eula_button_agree_cb), helper);
+	widget = glade_xml_get_widget (helper->priv->glade_xml, "button_help");
+	g_signal_connect (widget, "clicked", G_CALLBACK (gpk_helper_eula_button_help_cb), helper);
+	widget = glade_xml_get_widget (helper->priv->glade_xml, "button_cancel");
+	g_signal_connect (widget, "clicked", G_CALLBACK (gpk_helper_eula_button_cancel_cb), helper);
+}
+
+/**
+ * gpk_helper_eula_finalize:
+ **/
+static void
+gpk_helper_eula_finalize (GObject *object)
+{
+	GtkWidget *widget;
+	GpkHelperEula *helper;
+
+	g_return_if_fail (GPK_IS_HELPER_EULA (object));
+
+	helper = GPK_HELPER_EULA (object);
+
+	/* hide window */
+	widget = glade_xml_get_widget (helper->priv->glade_xml, "dialog_eula");
+	if (GTK_IS_WIDGET (widget))
+		gtk_widget_hide (widget);
+	g_free (helper->priv->eula_id);
+	g_object_unref (helper->priv->glade_xml);
+
+	G_OBJECT_CLASS (gpk_helper_eula_parent_class)->finalize (object);
+}
+
+/**
+ * gpk_helper_eula_new:
+ **/
+GpkHelperEula *
+gpk_helper_eula_new (void)
+{
+	GpkHelperEula *helper;
+	helper = g_object_new (GPK_TYPE_HELPER_EULA, NULL);
+	return GPK_HELPER_EULA (helper);
+}
+

Added: trunk/src/gpk-helper-eula.h
==============================================================================
--- (empty file)
+++ trunk/src/gpk-helper-eula.h	Mon Mar 23 09:45:49 2009
@@ -0,0 +1,67 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 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_HELPER_EULA_H
+#define __GPK_HELPER_EULA_H
+
+#include <glib-object.h>
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+#define GPK_TYPE_HELPER_EULA		(gpk_helper_eula_get_type ())
+#define GPK_HELPER_EULA(o)		(G_TYPE_CHECK_INSTANCE_CAST ((o), GPK_TYPE_HELPER_EULA, GpkHelperEula))
+#define GPK_HELPER_EULA_CLASS(k)	(G_TYPE_CHECK_CLASS_CAST((k), GPK_TYPE_HELPER_EULA, GpkHelperEulaClass))
+#define GPK_IS_HELPER_EULA(o)		(G_TYPE_CHECK_INSTANCE_TYPE ((o), GPK_TYPE_HELPER_EULA))
+#define GPK_IS_HELPER_EULA_CLASS(k)	(G_TYPE_CHECK_CLASS_TYPE ((k), GPK_TYPE_HELPER_EULA))
+#define GPK_HELPER_EULA_GET_CLASS(o)	(G_TYPE_INSTANCE_GET_CLASS ((o), GPK_TYPE_HELPER_EULA, GpkHelperEulaClass))
+#define GPK_HELPER_EULA_ERROR		(gpk_helper_eula_error_quark ())
+#define GPK_HELPER_EULA_TYPE_ERROR	(gpk_helper_eula_error_get_type ())
+
+typedef struct GpkHelperEulaPrivate GpkHelperEulaPrivate;
+
+typedef struct
+{
+	 GObject			 parent;
+	 GpkHelperEulaPrivate	*priv;
+} GpkHelperEula;
+
+typedef struct
+{
+	void		(* event)			(GpkHelperEula		*helper,
+							 GtkResponseType	 type,
+							 const gchar		*eula_id);
+	GObjectClass	parent_class;
+} GpkHelperEulaClass;
+
+GType		 gpk_helper_eula_get_type	  	(void);
+GpkHelperEula	*gpk_helper_eula_new			(void);
+gboolean	 gpk_helper_eula_set_parent		(GpkHelperEula		*helper,
+							 GtkWindow		*window);
+gboolean	 gpk_helper_eula_show			(GpkHelperEula		*helper,
+							 const gchar		*eula_id,
+							 const gchar		*package_id,
+							 const gchar		*vendor_name,
+							 const gchar		*license_agreement);
+
+G_END_DECLS
+
+#endif /* __GPK_HELPER_EULA_H */

Added: trunk/src/gpk-helper-repo-signature.c
==============================================================================
--- (empty file)
+++ trunk/src/gpk-helper-repo-signature.c	Mon Mar 23 09:45:49 2009
@@ -0,0 +1,230 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 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/gi18n.h>
+#include <gtk/gtk.h>
+#include <glade/glade.h>
+
+#include "gpk-helper-repo-signature.h"
+#include "gpk-marshal.h"
+#include "gpk-gnome.h"
+#include "gpk-common.h"
+
+#include "egg-debug.h"
+
+static void     gpk_helper_repo_signature_finalize	(GObject	  *object);
+
+#define GPK_HELPER_REPO_SIGNATURE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GPK_TYPE_HELPER_REPO_SIGNATURE, GpkHelperRepoSignaturePrivate))
+
+struct GpkHelperRepoSignaturePrivate
+{
+	GladeXML		*glade_xml;
+	gchar			*key_id;
+	gchar			*package_id;
+};
+
+enum {
+	GPK_HELPER_REPO_SIGNATURE_EVENT,
+	GPK_HELPER_REPO_SIGNATURE_LAST_SIGNAL
+};
+
+static guint signals [GPK_HELPER_REPO_SIGNATURE_LAST_SIGNAL] = { 0 };
+G_DEFINE_TYPE (GpkHelperRepoSignature, gpk_helper_repo_signature, G_TYPE_OBJECT)
+
+/**
+ * gpk_helper_repo_signature_button_yes_cb:
+ **/
+static void
+gpk_helper_repo_signature_button_yes_cb (GtkWidget *widget, GpkHelperRepoSignature *helper)
+{
+	g_signal_emit (helper, signals [GPK_HELPER_REPO_SIGNATURE_EVENT], 0,
+		       GTK_RESPONSE_YES, helper->priv->key_id, helper->priv->package_id);
+	widget = glade_xml_get_widget (helper->priv->glade_xml, "dialog_gpg");
+	gtk_widget_hide (widget);
+}
+
+/**
+ * gpk_helper_repo_signature_button_no_cb:
+ **/
+static void
+gpk_helper_repo_signature_button_no_cb (GtkWidget *widget, GpkHelperRepoSignature *helper)
+{
+	g_signal_emit (helper, signals [GPK_HELPER_REPO_SIGNATURE_EVENT], 0,
+		       GTK_RESPONSE_NO, helper->priv->key_id, helper->priv->package_id);
+	widget = glade_xml_get_widget (helper->priv->glade_xml, "dialog_gpg");
+	gtk_widget_hide (widget);
+}
+
+/**
+ * gpk_helper_repo_signature_button_help_cb:
+ **/
+static void
+gpk_helper_repo_signature_button_help_cb (GtkWidget *widget, GpkHelperRepoSignature *helper)
+{
+	/* show the help */
+	gpk_gnome_help ("gpg-signature");
+}
+
+/**
+ * gpk_helper_repo_signature_show:
+ *
+ * Return value: if we agreed
+ **/
+gboolean
+gpk_helper_repo_signature_show (GpkHelperRepoSignature *helper, const gchar *package_id, const gchar *repository_name,
+				const gchar *key_url, const gchar *key_userid, const gchar *key_id,
+				const gchar *key_fingerprint, const gchar *key_timestamp)
+{
+	GtkWidget *widget;
+
+	g_return_val_if_fail (GPK_IS_HELPER_REPO_SIGNATURE (helper), FALSE);
+	g_return_val_if_fail (package_id != NULL, FALSE);
+
+	/* cache */
+	g_free (helper->priv->key_id);
+	g_free (helper->priv->package_id);
+	helper->priv->key_id = g_strdup (key_id);
+	helper->priv->package_id = g_strdup (package_id);
+
+	/* show correct text */
+	widget = glade_xml_get_widget (helper->priv->glade_xml, "label_name");
+	gtk_label_set_label (GTK_LABEL (widget), repository_name);
+	widget = glade_xml_get_widget (helper->priv->glade_xml, "label_url");
+	gtk_label_set_label (GTK_LABEL (widget), key_url);
+	widget = glade_xml_get_widget (helper->priv->glade_xml, "label_user");
+	gtk_label_set_label (GTK_LABEL (widget), key_userid);
+	widget = glade_xml_get_widget (helper->priv->glade_xml, "label_id");
+	gtk_label_set_label (GTK_LABEL (widget), key_id);
+
+	/* show window */
+	widget = glade_xml_get_widget (helper->priv->glade_xml, "dialog_gpg");
+	gtk_widget_show (widget);
+
+	return TRUE;
+}
+
+/**
+ * gpk_helper_repo_signature_set_parent:
+ **/
+gboolean
+gpk_helper_repo_signature_set_parent (GpkHelperRepoSignature *helper, GtkWindow *window)
+{
+	GtkWidget *widget;
+
+	g_return_val_if_fail (GPK_IS_HELPER_REPO_SIGNATURE (helper), FALSE);
+	g_return_val_if_fail (window != NULL, FALSE);
+
+	/* make modal if window set */
+	widget = glade_xml_get_widget (helper->priv->glade_xml, "dialog_gpg");
+	gtk_window_set_transient_for (GTK_WINDOW (widget), window);
+
+	/* this is a modal popup, so don't show a window title */
+	gtk_window_set_title (GTK_WINDOW (widget), "");
+
+	return TRUE;
+}
+
+/**
+ * gpk_helper_repo_signature_class_init:
+ * @klass: The GpkHelperRepoSignatureClass
+ **/
+static void
+gpk_helper_repo_signature_class_init (GpkHelperRepoSignatureClass *klass)
+{
+	GObjectClass *object_class = G_OBJECT_CLASS (klass);
+	object_class->finalize = gpk_helper_repo_signature_finalize;
+	g_type_class_add_private (klass, sizeof (GpkHelperRepoSignaturePrivate));
+	signals [GPK_HELPER_REPO_SIGNATURE_EVENT] =
+		g_signal_new ("event",
+			      G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
+			      G_STRUCT_OFFSET (GpkHelperRepoSignatureClass, event),
+			      NULL, NULL, gpk_marshal_VOID__UINT_STRING_STRING,
+			      G_TYPE_NONE, 3, G_TYPE_UINT, G_TYPE_STRING, G_TYPE_STRING);
+}
+
+/**
+ * gpk_helper_repo_signature_init:
+ **/
+static void
+gpk_helper_repo_signature_init (GpkHelperRepoSignature *helper)
+{
+	GtkWidget *widget;
+
+	helper->priv = GPK_HELPER_REPO_SIGNATURE_GET_PRIVATE (helper);
+
+	helper->priv->key_id = NULL;
+	helper->priv->package_id = NULL;
+	helper->priv->glade_xml = glade_xml_new (GPK_DATA "/gpk-signature.glade", NULL, NULL);
+
+	/* connect up default actions */
+	widget = glade_xml_get_widget (helper->priv->glade_xml, "dialog_gpg");
+	g_signal_connect (widget, "delete_event", G_CALLBACK (gpk_helper_repo_signature_button_no_cb), helper);
+
+	/* set icon name */
+	widget = glade_xml_get_widget (helper->priv->glade_xml, "dialog_gpg");
+	gtk_window_set_icon_name (GTK_WINDOW (widget), GPK_ICON_SOFTWARE_INSTALLER);
+
+	/* connect up buttons */
+	widget = glade_xml_get_widget (helper->priv->glade_xml, "button_yes");
+	g_signal_connect (widget, "clicked", G_CALLBACK (gpk_helper_repo_signature_button_yes_cb), helper);
+	widget = glade_xml_get_widget (helper->priv->glade_xml, "button_help");
+	g_signal_connect (widget, "clicked", G_CALLBACK (gpk_helper_repo_signature_button_help_cb), helper);
+	widget = glade_xml_get_widget (helper->priv->glade_xml, "button_no");
+	g_signal_connect (widget, "clicked", G_CALLBACK (gpk_helper_repo_signature_button_no_cb), helper);
+}
+
+/**
+ * gpk_helper_repo_signature_finalize:
+ **/
+static void
+gpk_helper_repo_signature_finalize (GObject *object)
+{
+	GtkWidget *widget;
+	GpkHelperRepoSignature *helper;
+
+	g_return_if_fail (GPK_IS_HELPER_REPO_SIGNATURE (object));
+
+	helper = GPK_HELPER_REPO_SIGNATURE (object);
+
+	/* hide window */
+	widget = glade_xml_get_widget (helper->priv->glade_xml, "dialog_gpg");
+	if (GTK_IS_WIDGET (widget))
+		gtk_widget_hide (widget);
+	g_free (helper->priv->key_id);
+	g_free (helper->priv->package_id);
+	g_object_unref (helper->priv->glade_xml);
+
+	G_OBJECT_CLASS (gpk_helper_repo_signature_parent_class)->finalize (object);
+}
+
+/**
+ * gpk_helper_repo_signature_new:
+ **/
+GpkHelperRepoSignature *
+gpk_helper_repo_signature_new (void)
+{
+	GpkHelperRepoSignature *helper;
+	helper = g_object_new (GPK_TYPE_HELPER_REPO_SIGNATURE, NULL);
+	return GPK_HELPER_REPO_SIGNATURE (helper);
+}
+

Added: trunk/src/gpk-helper-repo-signature.h
==============================================================================
--- (empty file)
+++ trunk/src/gpk-helper-repo-signature.h	Mon Mar 23 09:45:49 2009
@@ -0,0 +1,71 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 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_HELPER_REPO_SIGNATURE_H
+#define __GPK_HELPER_REPO_SIGNATURE_H
+
+#include <glib-object.h>
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+#define GPK_TYPE_HELPER_REPO_SIGNATURE		(gpk_helper_repo_signature_get_type ())
+#define GPK_HELPER_REPO_SIGNATURE(o)		(G_TYPE_CHECK_INSTANCE_CAST ((o), GPK_TYPE_HELPER_REPO_SIGNATURE, GpkHelperRepoSignature))
+#define GPK_HELPER_REPO_SIGNATURE_CLASS(k)	(G_TYPE_CHECK_CLASS_CAST((k), GPK_TYPE_HELPER_REPO_SIGNATURE, GpkHelperRepoSignatureClass))
+#define GPK_IS_HELPER_REPO_SIGNATURE(o)		(G_TYPE_CHECK_INSTANCE_TYPE ((o), GPK_TYPE_HELPER_REPO_SIGNATURE))
+#define GPK_IS_HELPER_REPO_SIGNATURE_CLASS(k)	(G_TYPE_CHECK_CLASS_TYPE ((k), GPK_TYPE_HELPER_REPO_SIGNATURE))
+#define GPK_HELPER_REPO_SIGNATURE_GET_CLASS(o)	(G_TYPE_INSTANCE_GET_CLASS ((o), GPK_TYPE_HELPER_REPO_SIGNATURE, GpkHelperRepoSignatureClass))
+#define GPK_HELPER_REPO_SIGNATURE_ERROR		(gpk_helper_repo_signature_error_quark ())
+#define GPK_HELPER_REPO_SIGNATURE_TYPE_ERROR	(gpk_helper_repo_signature_error_get_type ())
+
+typedef struct GpkHelperRepoSignaturePrivate GpkHelperRepoSignaturePrivate;
+
+typedef struct
+{
+	 GObject			 parent;
+	 GpkHelperRepoSignaturePrivate	*priv;
+} GpkHelperRepoSignature;
+
+typedef struct
+{
+	void		(* event)				(GpkHelperRepoSignature	*helper,
+								 GtkResponseType	 type,
+								 const gchar		*key_id,
+								 const gchar		*package_id);
+	GObjectClass	parent_class;
+} GpkHelperRepoSignatureClass;
+
+GType			 gpk_helper_repo_signature_get_type	(void);
+GpkHelperRepoSignature	*gpk_helper_repo_signature_new		(void);
+gboolean		 gpk_helper_repo_signature_set_parent	(GpkHelperRepoSignature	*helper,
+								 GtkWindow		*window);
+gboolean		 gpk_helper_repo_signature_show		(GpkHelperRepoSignature	*helper,
+								 const gchar		*package_id,
+								 const gchar		*repository_name,
+								 const gchar		*key_url,
+								 const gchar		*key_userid,
+								 const gchar		*key_id,
+								 const gchar		*key_fingerprint,
+								 const gchar		*key_timestamp);
+
+G_END_DECLS
+
+#endif /* __GPK_HELPER_REPO_SIGNATURE_H */

Modified: trunk/src/gpk-update-viewer.c
==============================================================================
--- trunk/src/gpk-update-viewer.c	(original)
+++ trunk/src/gpk-update-viewer.c	Mon Mar 23 09:45:49 2009
@@ -925,12 +925,6 @@
 		g_free (line);
 	}
 
-	/* changelog */
-	if (!egg_strzero (obj->changelog)) {
-		/* TRANSLATORS: this is a list of CVE (security) URLs */
-		gpk_update_viewer_add_description_item (_("Changes"), obj->changelog, NULL);
-	}
-
 	/* add all the links */
 	if (!egg_strzero (obj->vendor_url)) {
 		/* TRANSLATORS: this is a list of vendor URLs */

Modified: trunk/src/gpk-update-viewer2.c
==============================================================================
--- trunk/src/gpk-update-viewer2.c	(original)
+++ trunk/src/gpk-update-viewer2.c	Mon Mar 23 09:45:49 2009
@@ -49,8 +49,8 @@
 #include "gpk-cell-renderer-percentage.h"
 #include "gpk-client.h"
 #include "gpk-enum.h"
-#include "gpk-repo-signature-helper.h"
-#include "gpk-eula-helper.h"
+#include "gpk-helper-repo-signature.h"
+#include "gpk-helper-eula.h"
 
 #define GPK_UPDATE_VIEWER_AUTO_SHUTDOWN_TIMEOUT 10 /* seconds */
 #define GNOME_SESSION_MANAGER_SERVICE		"org.gnome.SessionManager"
@@ -66,8 +66,8 @@
 static PkClient *client_secondary = NULL;
 static PkControl *control = NULL;
 static PkPackageList *update_list = NULL;
-static GpkRepoSignatureHelper *repo_signature_helper = NULL;
-static GpkEulaHelper *eula_helper = NULL;
+static GpkHelperRepoSignature *helper_repo_signature = NULL;
+static GpkHelperEula *helper_eula = NULL;
 static EggMarkdown *markdown = NULL;
 static PkPackageId *package_id_last = NULL;
 static PkRestartEnum restart_update = PK_RESTART_ENUM_NONE;
@@ -195,6 +195,7 @@
 {
 	GtkTreeModel *model;
 	GtkTreeIter iter;
+	GtkTreeSelection *selection;
 	gboolean ret;
 	gboolean valid;
 	gboolean update;
@@ -250,6 +251,10 @@
 		return;
 	}
 
+	/* clear the selection */
+	selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (widget));
+	gtk_tree_selection_unselect_all (selection);
+
 	/* reset client */
 	ret = pk_client_reset (client_primary, &error);
 	if (!ret) {
@@ -621,6 +626,8 @@
 		gtk_label_set_label (GTK_LABEL (widget), text);
 		g_free (text);
 		gtk_widget_show (widget);
+		widget = glade_xml_get_widget (glade_xml, "label_summary");
+		gtk_widget_hide (widget);
 
 		/* close button */
 		widget = glade_xml_get_widget (glade_xml, "button_close");
@@ -985,6 +992,7 @@
 	gchar *issued;
 	gchar *updated;
 	GtkTextIter iter;
+	gboolean update_text = FALSE;
 
 	/* get info  */
 	widget = glade_xml_get_widget (glade_xml, "treeview_updates");
@@ -1049,6 +1057,7 @@
 		if (!egg_strzero (line)) {
 			gtk_text_buffer_insert_markup (text_buffer, &iter, line);
 			gtk_text_buffer_insert (text_buffer, &iter, "\n\n", -1);
+			update_text = TRUE;
 		}
 		g_free (line);
 	}
@@ -1104,12 +1113,12 @@
 		gtk_text_buffer_insert (text_buffer, &iter, "\n", -1);
 	}
 
-	/* changelog */
-	if (!egg_strzero (obj->changelog)) {
+	/* only show changelog if we didn't have any update text */
+	if (!update_text && !egg_strzero (obj->changelog)) {
 		line = egg_markdown_parse (markdown, obj->changelog);
 		if (!egg_strzero (line)) {
 			/* TRANSLATORS: this is a ChangeLog */
-			line2 = g_strdup_printf ("\n%s\n%s\n", _("List of changes:"), line);
+			line2 = g_strdup_printf ("%s\n%s\n", _("The developer logs will be shown as no information is available for this update:"), line);
 			gtk_text_buffer_insert_markup (text_buffer, &iter, line2);
 			g_free (line2);
 		}
@@ -1545,12 +1554,13 @@
 /**
  * gpk_update_viewer_get_checked_status:
  **/
-static void
+static gboolean
 gpk_update_viewer_get_checked_status (gboolean *all_checked, gboolean *none_checked)
 {
 	GtkTreeView *treeview;
 	gboolean valid;
 	gboolean update;
+	gboolean clickable;
 	GtkTreeIter iter;
 	GtkTreeModel *model;
 
@@ -1561,13 +1571,16 @@
 	*all_checked = TRUE;
 	*none_checked = TRUE;
 	while (valid) {
-		gtk_tree_model_get (model, &iter, GPK_UPDATES_COLUMN_SELECT, &update, -1);
+		gtk_tree_model_get (model, &iter,
+				    GPK_UPDATES_COLUMN_SELECT, &update,
+				    GPK_UPDATES_COLUMN_CLICKABLE, &clickable, -1);
 		if (update)
 			*none_checked = FALSE;
 		else
 			*all_checked = FALSE;
 		valid = gtk_tree_model_iter_next (model, &iter);
 	}
+	return clickable;
 }
 
 /**
@@ -1580,11 +1593,16 @@
 	GtkWidget *menuitem;
 	gboolean all_checked;
 	gboolean none_checked;
+	gboolean ret;
 
 	menu = gtk_menu_new();
 
 	/* we don't want to show 'Select all' if they are all checked */
-	gpk_update_viewer_get_checked_status (&all_checked, &none_checked);
+	ret = gpk_update_viewer_get_checked_status (&all_checked, &none_checked);
+	if (!ret) {
+		egg_debug ("ignoring as we are locked down");
+		return;
+	}
 
 	if (!all_checked) {
 		/* TRANSLATORS: right click menu, select all the updates */
@@ -1721,14 +1739,14 @@
 				    const gchar *vendor_name, const gchar *license_agreement, gpointer data)
 {
 	/* use the helper */
-	gpk_eula_helper_show (eula_helper, eula_id, package_id, vendor_name, license_agreement);
+	gpk_helper_eula_show (helper_eula, eula_id, package_id, vendor_name, license_agreement);
 }
 
 /**
  * gpk_update_viewer_repo_signature_event_cb:
  **/
 static void
-gpk_update_viewer_repo_signature_event_cb (GpkRepoSignatureHelper *_repo_signature_helper, GtkResponseType type, const gchar *key_id, const gchar *package_id, gpointer data)
+gpk_update_viewer_repo_signature_event_cb (GpkHelperRepoSignature *_helper_repo_signature, GtkResponseType type, const gchar *key_id, const gchar *package_id, gpointer data)
 {
 	GtkWidget *widget;
 	GtkTreeModel *model;
@@ -1770,7 +1788,7 @@
  * gpk_update_viewer_eula_event_cb:
  **/
 static void
-gpk_update_viewer_eula_event_cb (GpkRepoSignatureHelper *_eula_helper, GtkResponseType type, const gchar *eula_id, gpointer data)
+gpk_update_viewer_eula_event_cb (GpkHelperRepoSignature *_helper_eula, GtkResponseType type, const gchar *eula_id, gpointer data)
 {
 	GtkWidget *widget;
 	GtkTreeModel *model;
@@ -1818,7 +1836,7 @@
 					      PkSigTypeEnum type, gpointer data)
 {
 	/* use the helper */
-	gpk_repo_signature_helper_show (repo_signature_helper, package_id, repository_name, key_url, key_userid, key_id, key_fingerprint, key_timestamp);
+	gpk_helper_repo_signature_show (helper_repo_signature, package_id, repository_name, key_url, key_userid, key_id, key_fingerprint, key_timestamp);
 }
 
 /**
@@ -2007,6 +2025,17 @@
 }
 
 /**
+ * gpk_update_viewer_updates_changed_cb:
+ **/
+static void
+gpk_update_viewer_updates_changed_cb (PkControl *_control, gpointer data)
+{
+	/* now try to get newest update list */
+	egg_debug ("updates changed");
+	gpk_update_viewer_get_new_update_list ();
+}
+
+/**
  * main:
  **/
 int
@@ -2079,10 +2108,13 @@
 	markdown = egg_markdown_new ();
 	egg_markdown_set_output (markdown, EGG_MARKDOWN_OUTPUT_PANGO);
 	egg_markdown_set_escape (markdown, TRUE);
+	egg_markdown_set_autocode (markdown, TRUE);
 
 	control = pk_control_new ();
 	g_signal_connect (control, "repo-list-changed",
 			  G_CALLBACK (gpk_update_viewer_repo_list_changed_cb), NULL);
+	g_signal_connect (control, "updates-changed",
+			  G_CALLBACK (gpk_update_viewer_updates_changed_cb), NULL);
 
 	/* this is what we use mainly */
 	client_primary = pk_client_new ();
@@ -2125,13 +2157,13 @@
 	g_signal_connect (main_window, "delete_event", G_CALLBACK (gpk_update_viewer_button_delete_event_cb), NULL);
 
 	/* helpers */
-	repo_signature_helper = gpk_repo_signature_helper_new ();
-	g_signal_connect (repo_signature_helper, "event", G_CALLBACK (gpk_update_viewer_repo_signature_event_cb), NULL);
-	gpk_repo_signature_helper_set_parent (repo_signature_helper, GTK_WINDOW (main_window));
-
-	eula_helper = gpk_eula_helper_new ();
-	g_signal_connect (eula_helper, "event", G_CALLBACK (gpk_update_viewer_eula_event_cb), NULL);
-	gpk_eula_helper_set_parent (eula_helper, GTK_WINDOW (main_window));
+	helper_repo_signature = gpk_helper_repo_signature_new ();
+	g_signal_connect (helper_repo_signature, "event", G_CALLBACK (gpk_update_viewer_repo_signature_event_cb), NULL);
+	gpk_helper_repo_signature_set_parent (helper_repo_signature, GTK_WINDOW (main_window));
+
+	helper_eula = gpk_helper_eula_new ();
+	g_signal_connect (helper_eula, "event", G_CALLBACK (gpk_update_viewer_eula_event_cb), NULL);
+	gpk_helper_eula_set_parent (helper_eula, GTK_WINDOW (main_window));
 
 	/* create list stores */
 	list_store_updates = gtk_list_store_new (GPK_UPDATES_COLUMN_LAST, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT,
@@ -2270,8 +2302,8 @@
 	if (update_list != NULL)
 		g_object_unref (update_list);
 
-	g_object_unref (eula_helper);
-	g_object_unref (repo_signature_helper);
+	g_object_unref (helper_eula);
+	g_object_unref (helper_repo_signature);
 	g_object_unref (glade_xml);
 	g_object_unref (list_store_updates);
 	g_object_unref (control);



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