gnome-packagekit r327 - trunk/src
- From: rhughes svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-packagekit r327 - trunk/src
- Date: Wed, 8 Oct 2008 13:18:41 +0000 (UTC)
Author: rhughes
Date: Wed Oct 8 13:18:40 2008
New Revision: 327
URL: http://svn.gnome.org/viewvc/gnome-packagekit?rev=327&view=rev
Log:
from git
Modified:
trunk/src/gpk-application.c
trunk/src/gpk-common.h
Modified: trunk/src/gpk-application.c
==============================================================================
--- trunk/src/gpk-application.c (original)
+++ trunk/src/gpk-application.c Wed Oct 8 13:18:40 2008
@@ -143,7 +143,9 @@
enum {
GROUPS_COLUMN_ICON,
GROUPS_COLUMN_NAME,
+ GROUPS_COLUMN_SUMMARY,
GROUPS_COLUMN_ID,
+ GROUPS_COLUMN_ACTIVE,
GROUPS_COLUMN_LAST
};
@@ -1671,7 +1673,8 @@
/* column for name */
renderer = gtk_cell_renderer_text_new ();
column = gtk_tree_view_column_new_with_attributes (_("Name"), renderer,
- "text", GROUPS_COLUMN_NAME, NULL);
+ "text", GROUPS_COLUMN_NAME,
+ "text", GROUPS_COLUMN_SUMMARY, NULL);
gtk_tree_view_column_set_sort_column_id (column, GROUPS_COLUMN_NAME);
gtk_tree_view_append_column (treeview, column);
@@ -1686,6 +1689,9 @@
GtkTreeModel *model;
GtkTreeIter iter;
GtkWidget *widget;
+ GtkTreeView *treeview;
+ GtkTreePath *path;
+ gboolean active;
g_return_if_fail (PK_IS_APPLICATION (application));
@@ -1700,15 +1706,27 @@
/* This will only work in single or browse selection mode! */
if (gtk_tree_selection_get_selected (selection, &model, &iter)) {
g_free (application->priv->group);
- gtk_tree_model_get (model, &iter, GROUPS_COLUMN_ID, &application->priv->group, -1);
- egg_debug ("selected row is: %s", application->priv->group);
+ gtk_tree_model_get (model, &iter,
+ GROUPS_COLUMN_ID, &application->priv->group,
+ GROUPS_COLUMN_ACTIVE, &active, -1);
+ egg_debug ("selected row is: %s (%i)", application->priv->group, active);
+
+ /* don't search parent groups */
+ if (!active) {
+ treeview = GTK_TREE_VIEW (glade_xml_get_widget (application->priv->glade_xml, "treeview_detail"));
+ path = gtk_tree_model_get_path (model, &iter);
+
+ /* select the parent group */
+ gtk_tree_selection_select_path (selection, path);
+ gtk_tree_path_free (path);
+ return;
+ }
/* GetPackages? */
- if (egg_strequal (application->priv->group, "all-packages")) {
+ if (egg_strequal (application->priv->group, "all-packages"))
application->priv->search_mode = PK_MODE_ALL_PACKAGES;
- } else {
+ else
application->priv->search_mode = PK_MODE_GROUP;
- }
/* actually do the search */
gpk_application_perform_search (application);
@@ -1838,8 +1856,10 @@
icon_name = gpk_group_enum_to_icon_name (group);
gtk_tree_store_set (application->priv->groups_store, &iter,
GROUPS_COLUMN_NAME, text,
+ GROUPS_COLUMN_SUMMARY, NULL,
GROUPS_COLUMN_ID, pk_group_enum_to_text (group),
GROUPS_COLUMN_ICON, icon_name,
+ GROUPS_COLUMN_ACTIVE, TRUE,
-1);
}
@@ -2644,6 +2664,25 @@
{
GtkWidget *widget;
guint i;
+ GtkTreeIter iter;
+ const gchar *icon_name;
+
+ /* set to no indent */
+ widget = glade_xml_get_widget (application->priv->glade_xml, "treeview_groups");
+ gtk_tree_view_set_show_expanders (GTK_TREE_VIEW (widget), FALSE);
+ gtk_tree_view_set_level_indentation (GTK_TREE_VIEW (widget), 0);
+
+ /* add an "all" entry if we can GetPackages */
+ if (pk_bitfield_contain (application->priv->roles, PK_ROLE_ENUM_GET_PACKAGES)) {
+ gtk_tree_store_append (application->priv->groups_store, &iter, NULL);
+ icon_name = gpk_role_enum_to_icon_name (PK_ROLE_ENUM_GET_PACKAGES);
+ gtk_tree_store_set (application->priv->groups_store, &iter,
+ GROUPS_COLUMN_NAME, _("All packages"),
+ GROUPS_COLUMN_SUMMARY, _("Show all packages"),
+ GROUPS_COLUMN_ID, "all-packages",
+ GROUPS_COLUMN_ACTIVE, TRUE,
+ GROUPS_COLUMN_ICON, icon_name, -1);
+ }
/* no group information */
if (application->priv->groups == 0)
@@ -2653,18 +2692,13 @@
if (pk_bitfield_contain (application->priv->groups, PK_GROUP_ENUM_COLLECTIONS))
gpk_application_group_add_data (application, PK_GROUP_ENUM_COLLECTIONS);
- /* only if we can do both */
+ /* add a separator only if we can do both */
if ((pk_bitfield_contain (application->priv->roles, PK_ROLE_ENUM_GET_PACKAGES) ||
pk_bitfield_contain (application->priv->groups, PK_GROUP_ENUM_COLLECTIONS)) &&
pk_bitfield_contain (application->priv->roles, PK_ROLE_ENUM_SEARCH_GROUP)) {
- GtkTreeIter iter;
-
- /* add a separator */
gtk_tree_store_append (application->priv->groups_store, &iter, NULL);
gtk_tree_store_set (application->priv->groups_store, &iter,
GROUPS_COLUMN_ID, "separator", -1);
-
- /* use the seporator */
widget = glade_xml_get_widget (application->priv->glade_xml, "treeview_groups");
gtk_tree_view_set_row_separator_func (GTK_TREE_VIEW (widget),
gpk_application_group_row_separator_func, NULL, NULL);
@@ -2698,6 +2732,39 @@
GtkTreeIter iter2;
guint i, j;
GtkWidget *widget;
+ const gchar *icon_name;
+
+ /* set to expanders with indent */
+ widget = glade_xml_get_widget (application->priv->glade_xml, "treeview_groups");
+ gtk_tree_view_set_show_expanders (GTK_TREE_VIEW (widget), TRUE);
+ gtk_tree_view_set_level_indentation (GTK_TREE_VIEW (widget), 3);
+
+ /* add an "all" entry if we can GetPackages */
+ if (pk_bitfield_contain (application->priv->roles, PK_ROLE_ENUM_GET_PACKAGES)) {
+ gtk_tree_store_append (application->priv->groups_store, &iter, NULL);
+ icon_name = gpk_role_enum_to_icon_name (PK_ROLE_ENUM_GET_PACKAGES);
+ gtk_tree_store_set (application->priv->groups_store, &iter,
+ GROUPS_COLUMN_NAME, _("All packages"),
+ GROUPS_COLUMN_SUMMARY, _("Show all packages"),
+ GROUPS_COLUMN_ID, "all-packages",
+ GROUPS_COLUMN_ACTIVE, TRUE,
+ GROUPS_COLUMN_ICON, icon_name, -1);
+ }
+
+ /* add this at the top of the list */
+ if (pk_bitfield_contain (application->priv->groups, PK_GROUP_ENUM_COLLECTIONS))
+ gpk_application_group_add_data (application, PK_GROUP_ENUM_COLLECTIONS);
+
+ /* add a separator only if we can do both */
+ if (pk_bitfield_contain (application->priv->roles, PK_ROLE_ENUM_GET_PACKAGES) ||
+ pk_bitfield_contain (application->priv->groups, PK_GROUP_ENUM_COLLECTIONS)) {
+ gtk_tree_store_append (application->priv->groups_store, &iter, NULL);
+ gtk_tree_store_set (application->priv->groups_store, &iter,
+ GROUPS_COLUMN_ID, "separator", -1);
+ widget = glade_xml_get_widget (application->priv->glade_xml, "treeview_groups");
+ gtk_tree_view_set_row_separator_func (GTK_TREE_VIEW (widget),
+ gpk_application_group_row_separator_func, NULL, NULL);
+ }
/* get return values */
categories = pk_client_get_cached_objects (client);
@@ -2718,19 +2785,24 @@
gtk_tree_store_append (application->priv->groups_store, &iter, NULL);
gtk_tree_store_set (application->priv->groups_store, &iter,
GROUPS_COLUMN_NAME, obj->name,
+ GROUPS_COLUMN_SUMMARY, obj->summary,
GROUPS_COLUMN_ID, obj->cat_id,
- GROUPS_COLUMN_ICON, obj->icon, -1);
+ GROUPS_COLUMN_ICON, obj->icon,
+ GROUPS_COLUMN_ACTIVE, FALSE,
+ -1);
j = 0;
do {
/* only allows groups two layers deep */
obj2 = egg_obj_list_index (list, j);
if (egg_strequal (obj2->parent_id, obj->cat_id)) {
- egg_debug ("%s is child to %s", obj2->name, obj->name);
gtk_tree_store_append (application->priv->groups_store, &iter2, &iter);
gtk_tree_store_set (application->priv->groups_store, &iter2,
GROUPS_COLUMN_NAME, obj2->name,
+ GROUPS_COLUMN_SUMMARY, obj2->summary,
GROUPS_COLUMN_ID, obj2->cat_id,
- GROUPS_COLUMN_ICON, obj2->icon, -1);
+ GROUPS_COLUMN_ICON, obj2->icon,
+ GROUPS_COLUMN_ACTIVE, TRUE,
+ -1);
egg_obj_list_remove (list, obj2);
} else
j++;
@@ -2738,8 +2810,7 @@
}
/* open all expanders */
- widget = glade_xml_get_widget (application->priv->glade_xml, "treeview_groups");
- gtk_tree_view_expand_all (GTK_TREE_VIEW (widget));
+ gtk_tree_view_collapse_all (GTK_TREE_VIEW (widget));
g_object_unref (list);
out:
@@ -2785,6 +2856,30 @@
}
/**
+ * gpk_application_gconf_key_changed_cb:
+ *
+ * We might have to do things when the gconf keys change; do them here.
+ **/
+static void
+gpk_application_gconf_key_changed_cb (GConfClient *client, guint cnxn_id, GConfEntry *entry, GpkApplication *application)
+{
+ GConfValue *value;
+ gboolean ret;
+ value = gconf_entry_get_value (entry);
+ if (value == NULL)
+ return;
+
+ if (egg_strequal (entry->key, GPK_CONF_APPLICATION_CATEGORY_GROUPS)) {
+ ret = gconf_value_get_bool (value);
+ gtk_tree_store_clear (application->priv->groups_store);
+ if (ret)
+ gpk_application_create_group_list_categories (application);
+ else
+ gpk_application_create_group_list_enum (application);
+ }
+}
+
+/**
* gpk_application_init:
**/
static void
@@ -2815,6 +2910,13 @@
application->priv->search_mode = PK_MODE_UNKNOWN;
application->priv->filters_current = PK_FILTER_ENUM_NONE;
+ /* watch gnome-power-manager keys */
+ gconf_client_add_dir (application->priv->gconf_client, GPK_CONF_DIR,
+ GCONF_CLIENT_PRELOAD_NONE, NULL);
+ gconf_client_notify_add (application->priv->gconf_client, GPK_CONF_DIR,
+ (GConfClientNotifyFunc) gpk_application_gconf_key_changed_cb,
+ application, NULL, NULL);
+
/* create list stores */
application->priv->packages_store = gtk_list_store_new (PACKAGES_COLUMN_LAST,
G_TYPE_STRING,
@@ -2826,7 +2928,9 @@
application->priv->groups_store = gtk_tree_store_new (GROUPS_COLUMN_LAST,
G_TYPE_STRING,
G_TYPE_STRING,
- G_TYPE_STRING);
+ G_TYPE_STRING,
+ G_TYPE_STRING,
+ G_TYPE_BOOLEAN);
application->priv->details_store = gtk_list_store_new (DETAIL_COLUMN_LAST,
G_TYPE_STRING,
G_TYPE_STRING,
@@ -3240,23 +3344,12 @@
/* add columns to the tree view */
gpk_application_packages_add_columns (application);
- /* add an "all" entry if we can GetPackages */
- if (pk_bitfield_contain (application->priv->roles, PK_ROLE_ENUM_GET_PACKAGES)) {
- GtkTreeIter iter;
- const gchar *icon_name;
- gtk_tree_store_append (application->priv->groups_store, &iter, NULL);
- icon_name = gpk_role_enum_to_icon_name (PK_ROLE_ENUM_GET_PACKAGES);
- gtk_tree_store_set (application->priv->groups_store, &iter,
- GROUPS_COLUMN_NAME, _("All packages"),
- GROUPS_COLUMN_ID, "all-packages",
- GROUPS_COLUMN_ICON, icon_name, -1);
- }
-
/* set up the groups checkbox */
widget = glade_xml_get_widget (application->priv->glade_xml, "treeview_groups");
/* add columns to the tree view */
gpk_application_groups_add_columns (GTK_TREE_VIEW (widget));
+ gtk_tree_view_set_tooltip_column (GTK_TREE_VIEW (widget), GROUPS_COLUMN_SUMMARY);
gtk_tree_view_set_show_expanders (GTK_TREE_VIEW (widget), FALSE);
gtk_tree_view_set_level_indentation (GTK_TREE_VIEW (widget), 9);
gtk_tree_view_set_model (GTK_TREE_VIEW (widget),
Modified: trunk/src/gpk-common.h
==============================================================================
--- trunk/src/gpk-common.h (original)
+++ trunk/src/gpk-common.h Wed Oct 8 13:18:40 2008
@@ -29,6 +29,7 @@
G_BEGIN_DECLS
+#define GPK_CONF_DIR "/apps/gnome-packagekit"
#define GPK_CONF_NOTIFY_COMPLETED "/apps/gnome-packagekit/notify_complete"
#define GPK_CONF_NOTIFY_AVAILABLE "/apps/gnome-packagekit/notify_available"
#define GPK_CONF_NOTIFY_DISTRO_UPGRADES "/apps/gnome-packagekit/notify_distro_upgrades"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]