gnome-packagekit r221 - in trunk: data po src
- From: rhughes svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-packagekit r221 - in trunk: data po src
- Date: Tue, 10 Jun 2008 15:23:42 +0000 (UTC)
Author: rhughes
Date: Tue Jun 10 15:23:42 2008
New Revision: 221
URL: http://svn.gnome.org/viewvc/gnome-packagekit?rev=221&view=rev
Log:
from git
Modified:
trunk/data/Makefile.am
trunk/data/gpk-application.glade
trunk/po/POTFILES.in
trunk/src/.gitignore
trunk/src/Makefile.am
trunk/src/gpk-application.c
trunk/src/gpk-client-chooser.c
trunk/src/gpk-client.c
trunk/src/gpk-client.h
trunk/src/gpk-interface.h
trunk/src/gpk-update-viewer.c
Modified: trunk/data/Makefile.am
==============================================================================
--- trunk/data/Makefile.am (original)
+++ trunk/data/Makefile.am Tue Jun 10 15:23:42 2008
@@ -11,6 +11,7 @@
desktopdir = $(datadir)/applications
desktop_in_files = \
gpk-install-file.desktop.in \
+ gpk-install-catalog.desktop.in \
gpk-prefs.desktop.in \
gpk-application.desktop.in \
gpk-update-viewer.desktop.in \
@@ -64,6 +65,7 @@
gpk-repo.desktop \
gpk-prefs.desktop \
gpk-update-viewer.desktop \
+ gpk-install-catalog.desktop \
gpk-install-file.desktop \
gpk-log.desktop \
gpk-update-icon.desktop \
Modified: trunk/data/gpk-application.glade
==============================================================================
--- trunk/data/gpk-application.glade (original)
+++ trunk/data/gpk-application.glade Tue Jun 10 15:23:42 2008
@@ -14,6 +14,47 @@
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<child>
+ <widget class="GtkMenuItem" id="menuitem_system">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_System</property>
+ <property name="use_underline">True</property>
+ <child>
+ <widget class="GtkMenu" id="menu8">
+ <property name="visible">True</property>
+ <child>
+ <widget class="GtkImageMenuItem" id="menuitem_sources">
+ <property name="visible">True</property>
+ <property name="tooltip" translatable="yes">Edit list of software sources</property>
+ <property name="label" translatable="yes">Software sources</property>
+ <property name="use_underline">True</property>
+ <child internal-child="image">
+ <widget class="GtkImage" id="menu-item-image1">
+ <property name="stock">gtk-cdrom</property>
+ <property name="icon_size">1</property>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkImageMenuItem" id="menuitem_refresh">
+ <property name="visible">True</property>
+ <property name="tooltip" translatable="yes">Refresh the list of packages on the system</property>
+ <property name="label" translatable="yes">Refresh package lists</property>
+ <property name="use_underline">True</property>
+ <child internal-child="image">
+ <widget class="GtkImage" id="menu-item-image2">
+ <property name="visible">True</property>
+ <property name="stock">gtk-refresh</property>
+ <property name="icon_size">1</property>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ <child>
<widget class="GtkMenuItem" id="menuitem2">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
@@ -300,6 +341,117 @@
</widget>
</child>
<child>
+ <widget class="GtkMenuItem" id="menuitem_selection">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Selection</property>
+ <property name="use_underline">True</property>
+ <child>
+ <widget class="GtkMenu" id="menu9">
+ <property name="visible">True</property>
+ <child>
+ <widget class="GtkImageMenuItem" id="menuitem_install">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Install</property>
+ <property name="use_underline">True</property>
+ <child internal-child="image">
+ <widget class="GtkImage" id="menu-item-image3">
+ <property name="visible">True</property>
+ <property name="stock">gtk-floppy</property>
+ <property name="icon_size">1</property>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkImageMenuItem" id="menuitem_remove">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Remove</property>
+ <property name="use_underline">True</property>
+ <child internal-child="image">
+ <widget class="GtkImage" id="menu-item-image4">
+ <property name="visible">True</property>
+ <property name="stock">gtk-delete</property>
+ <property name="icon_size">1</property>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkImageMenuItem" id="menuitem_homepage">
+ <property name="visible">True</property>
+ <property name="tooltip" translatable="yes">Visit the project homepage</property>
+ <property name="label" translatable="yes">Project homepage</property>
+ <property name="use_underline">True</property>
+ <child internal-child="image">
+ <widget class="GtkImage" id="menu-item-image8">
+ <property name="visible">True</property>
+ <property name="stock">gtk-home</property>
+ <property name="icon_size">1</property>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkImageMenuItem" id="menuitem_run">
+ <property name="visible">True</property>
+ <property name="tooltip" translatable="yes">Execute graphical applications</property>
+ <property name="label" translatable="yes">Run program</property>
+ <property name="use_underline">True</property>
+ <child internal-child="image">
+ <widget class="GtkImage" id="menu-item-image9">
+ <property name="visible">True</property>
+ <property name="stock">gtk-execute</property>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkImageMenuItem" id="menuitem_files">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Get file list</property>
+ <property name="use_underline">True</property>
+ <child internal-child="image">
+ <widget class="GtkImage" id="menu-item-image7">
+ <property name="visible">True</property>
+ <property name="stock">gtk-file</property>
+ <property name="icon_size">1</property>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkImageMenuItem" id="menuitem_depends">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Depends on</property>
+ <property name="use_underline">True</property>
+ <child internal-child="image">
+ <widget class="GtkImage" id="menu-item-image5">
+ <property name="visible">True</property>
+ <property name="stock">gtk-go-back</property>
+ <property name="icon_size">1</property>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkImageMenuItem" id="menuitem_requires">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Required by</property>
+ <property name="use_underline">True</property>
+ <child internal-child="image">
+ <widget class="GtkImage" id="menu-item-image6">
+ <property name="visible">True</property>
+ <property name="stock">gtk-go-forward</property>
+ <property name="icon_size">1</property>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ <child>
<widget class="GtkMenuItem" id="menuitem_help">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
@@ -338,650 +490,549 @@
</packing>
</child>
<child>
- <widget class="GtkToolbar" id="toolbar1">
- <property name="visible">True</property>
- <property name="icon_size">GTK_ICON_SIZE_BUTTON</property>
- <child>
- <widget class="GtkToolButton" id="toolbutton_list_add">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Add to list</property>
- <property name="use_underline">True</property>
- <property name="stock_id">gtk-add</property>
- </widget>
- <packing>
- <property name="homogeneous">True</property>
- </packing>
- </child>
- <child>
- <widget class="GtkToolButton" id="toolbutton_list_clear">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Clear list</property>
- <property name="use_underline">True</property>
- <property name="stock_id">gtk-clear</property>
- </widget>
- <packing>
- <property name="homogeneous">True</property>
- </packing>
- </child>
- <child>
- <widget class="GtkToolButton" id="toolbutton_list_show">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Show list</property>
- <property name="use_underline">True</property>
- <property name="stock_id">gtk-edit</property>
- </widget>
- <packing>
- <property name="homogeneous">True</property>
- </packing>
- </child>
- <child>
- <widget class="GtkSeparatorToolItem" id="toolbutton2">
- <property name="visible">True</property>
- </widget>
- </child>
- <child>
- <widget class="GtkToolButton" id="toolbutton_install">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Install packages</property>
- <property name="use_underline">True</property>
- <property name="stock_id">gtk-floppy</property>
- </widget>
- <packing>
- <property name="homogeneous">True</property>
- </packing>
- </child>
- <child>
- <widget class="GtkToolButton" id="toolbutton_remove">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Remove packages</property>
- <property name="use_underline">True</property>
- <property name="stock_id">gtk-delete</property>
- </widget>
- <packing>
- <property name="homogeneous">True</property>
- </packing>
- </child>
- <child>
- <widget class="GtkSeparatorToolItem" id="toolbutton1">
- <property name="visible">True</property>
- </widget>
- </child>
- <child>
- <widget class="GtkToolButton" id="toolbutton_sources">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Software sources</property>
- <property name="use_underline">True</property>
- <property name="stock_id">gtk-cdrom</property>
- </widget>
- <packing>
- <property name="homogeneous">True</property>
- </packing>
- </child>
- <child>
- <widget class="GtkToolButton" id="toolbutton_refresh">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Refresh package lists</property>
- <property name="use_underline">True</property>
- <property name="stock_id">gtk-refresh</property>
- </widget>
- <packing>
- <property name="homogeneous">True</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <widget class="GtkVBox" id="vbox2">
+ <widget class="GtkHBox" id="hbox1">
<property name="visible">True</property>
<child>
- <widget class="GtkHBox" id="hbox1">
+ <widget class="GtkVBox" id="vbox2">
<property name="visible">True</property>
<child>
- <widget class="GtkHBox" id="hbox7">
+ <widget class="GtkVBox" id="vbox3">
<property name="visible">True</property>
- <property name="spacing">6</property>
<child>
- <widget class="GtkVBox" id="vbox_groups">
+ <widget class="GtkHBox" id="hbox7">
<property name="visible">True</property>
<property name="spacing">6</property>
<child>
- <widget class="GtkHBox" id="hbox26">
+ <widget class="GtkVBox" id="vbox_groups">
<property name="visible">True</property>
- <property name="spacing">5</property>
- <child>
- <widget class="Custom" id="entry_text">
- <property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- </widget>
- </child>
+ <property name="spacing">6</property>
<child>
- <widget class="GtkNotebook" id="notebook_search_cancel">
+ <widget class="GtkHBox" id="hbox26">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="show_tabs">False</property>
- <property name="show_border">False</property>
- <property name="tab_border">0</property>
- <property name="tab_hborder">0</property>
- <property name="tab_vborder">0</property>
+ <property name="spacing">5</property>
+ <child>
+ <widget class="Custom" id="entry_text">
+ <property name="visible">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ </widget>
+ </child>
<child>
- <widget class="GtkButton" id="button_find">
+ <widget class="GtkNotebook" id="notebook_search_cancel">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="response_id">0</property>
+ <property name="show_tabs">False</property>
+ <property name="show_border">False</property>
+ <property name="tab_border">0</property>
+ <property name="tab_hborder">0</property>
+ <property name="tab_vborder">0</property>
<child>
- <widget class="GtkAlignment" id="alignment5">
+ <widget class="GtkButton" id="button_find">
<property name="visible">True</property>
- <property name="xscale">0</property>
- <property name="yscale">0</property>
+ <property name="can_focus">True</property>
+ <property name="response_id">0</property>
<child>
- <widget class="GtkHBox" id="hbox6">
+ <widget class="GtkAlignment" id="alignment5">
<property name="visible">True</property>
- <property name="spacing">2</property>
- <child>
- <widget class="GtkImage" id="image4">
- <property name="visible">True</property>
- <property name="stock">gtk-find</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
+ <property name="xscale">0</property>
+ <property name="yscale">0</property>
<child>
- <widget class="GtkLabel" id="label_button_find">
+ <widget class="GtkHBox" id="hbox6">
<property name="visible">True</property>
- <property name="label">Fi_nd</property>
- <property name="use_underline">True</property>
+ <property name="spacing">2</property>
+ <child>
+ <widget class="GtkImage" id="image4">
+ <property name="visible">True</property>
+ <property name="stock">gtk-find</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label_button_find">
+ <property name="visible">True</property>
+ <property name="label">Fi_nd</property>
+ <property name="use_underline">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
</widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
</child>
</widget>
</child>
</widget>
</child>
- </widget>
- </child>
- <child>
- <widget class="GtkLabel" id="label_find">
- <property name="visible">True</property>
- <property name="label">find</property>
- </widget>
- <packing>
- <property name="type">tab</property>
- <property name="tab_fill">False</property>
- </packing>
- </child>
- <child>
- <widget class="GtkButton" id="button_cancel">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="response_id">0</property>
<child>
- <widget class="GtkAlignment" id="alignment2">
+ <widget class="GtkLabel" id="label_find">
+ <property name="visible">True</property>
+ <property name="label">find</property>
+ </widget>
+ <packing>
+ <property name="type">tab</property>
+ <property name="tab_fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkButton" id="button_cancel">
<property name="visible">True</property>
- <property name="xscale">0</property>
- <property name="yscale">0</property>
+ <property name="can_focus">True</property>
+ <property name="response_id">0</property>
<child>
- <widget class="GtkHBox" id="hbox3">
+ <widget class="GtkAlignment" id="alignment2">
<property name="visible">True</property>
- <property name="spacing">2</property>
- <child>
- <widget class="GtkImage" id="image2">
- <property name="visible">True</property>
- <property name="stock">gtk-dialog-error</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
+ <property name="xscale">0</property>
+ <property name="yscale">0</property>
<child>
- <widget class="GtkLabel" id="label_button_cancel">
+ <widget class="GtkHBox" id="hbox3">
<property name="visible">True</property>
- <property name="label">_Cancel</property>
- <property name="use_underline">True</property>
+ <property name="spacing">2</property>
+ <child>
+ <widget class="GtkImage" id="image2">
+ <property name="visible">True</property>
+ <property name="stock">gtk-dialog-error</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label_button_cancel">
+ <property name="visible">True</property>
+ <property name="label">_Cancel</property>
+ <property name="use_underline">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
</widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
</child>
</widget>
</child>
</widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label_cancel">
+ <property name="visible">True</property>
+ <property name="label">cancel</property>
+ </widget>
+ <packing>
+ <property name="type">tab</property>
+ <property name="position">1</property>
+ <property name="tab_fill">False</property>
+ </packing>
</child>
</widget>
<packing>
<property name="position">1</property>
</packing>
</child>
- <child>
- <widget class="GtkLabel" id="label_cancel">
- <property name="visible">True</property>
- <property name="label">cancel</property>
- </widget>
- <packing>
- <property name="type">tab</property>
- <property name="position">1</property>
- <property name="tab_fill">False</property>
- </packing>
- </child>
</widget>
<packing>
- <property name="position">1</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
</packing>
</child>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- <child>
- <widget class="GtkScrolledWindow" id="scrolledwindow_groups">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
- <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
- <property name="shadow_type">GTK_SHADOW_IN</property>
<child>
- <widget class="GtkTreeView" id="treeview_groups">
+ <widget class="GtkScrolledWindow" id="scrolledwindow_groups">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="border_width">3</property>
- <property name="headers_visible">False</property>
- <property name="enable_search">False</property>
+ <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <property name="shadow_type">GTK_SHADOW_IN</property>
+ <child>
+ <widget class="GtkTreeView" id="treeview_groups">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="border_width">3</property>
+ <property name="headers_visible">False</property>
+ <property name="enable_search">False</property>
+ </widget>
+ </child>
</widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
</child>
- </widget>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <widget class="GtkHBox" id="hbox_status">
- <property name="spacing">6</property>
<child>
- <widget class="Custom" id="image_status">
- <property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- </packing>
- </child>
- <child>
- <widget class="GtkLabel" id="label_status">
- <property name="visible">True</property>
- <property name="label">Querying</property>
- <property name="use_markup">True</property>
+ <widget class="GtkHBox" id="hbox_status">
+ <property name="spacing">6</property>
+ <child>
+ <widget class="Custom" id="image_status">
+ <property name="visible">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label_status">
+ <property name="visible">True</property>
+ <property name="label">Querying</property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
+ <property name="position">2</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
- <property name="position">2</property>
</packing>
</child>
- </widget>
- <packing>
- <property name="expand">False</property>
- </packing>
- </child>
- <child>
- <widget class="GtkScrolledWindow" id="scrolledwindow_packages">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
- <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
- <property name="shadow_type">GTK_SHADOW_IN</property>
- <child>
- <widget class="GtkTreeView" id="treeview_packages">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="headers_visible">False</property>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <widget class="GtkNotebook" id="notebook_description">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
<child>
- <widget class="GtkVBox" id="vbox_description">
+ <widget class="GtkVBox" id="vbox4">
<property name="visible">True</property>
- <property name="border_width">5</property>
<property name="spacing">6</property>
<child>
- <widget class="GtkScrolledWindow" id="scrolledwindow2">
+ <widget class="GtkScrolledWindow" id="scrolledwindow_packages">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="shadow_type">GTK_SHADOW_IN</property>
<child>
- <widget class="GtkTextView" id="textview_description">
+ <widget class="GtkTreeView" id="treeview_packages">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="border_width">2</property>
- <property name="editable">False</property>
- <property name="wrap_mode">GTK_WRAP_WORD</property>
- <property name="cursor_visible">False</property>
+ <property name="headers_visible">False</property>
</widget>
</child>
</widget>
</child>
<child>
- <widget class="GtkHBox" id="hbox5">
+ <widget class="GtkHBox" id="hbox2">
<property name="visible">True</property>
<property name="spacing">6</property>
<child>
- <widget class="GtkImage" id="image_icon">
- <property name="visible">True</property>
- <property name="stock">gtk-missing-image</property>
- <property name="icon_size">6</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- </packing>
- </child>
- <child>
- <widget class="GtkVBox" id="vbox3">
+ <widget class="GtkVButtonBox" id="vbuttonbox1">
<property name="visible">True</property>
- <property name="spacing">6</property>
+ <property name="spacing">3</property>
<child>
- <widget class="GtkHBox" id="hbox_source">
+ <widget class="GtkButton" id="button_install">
<property name="visible">True</property>
- <property name="spacing">6</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="response_id">0</property>
<child>
- <widget class="GtkLabel" id="label_source_text">
+ <widget class="GtkHBox" id="hbox9">
<property name="visible">True</property>
- <property name="label" translatable="yes">Source:</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- <child>
- <widget class="GtkLabel" id="label_source">
- <property name="visible">True</property>
- <property name="label">Fedora - Rawhide</property>
- <property name="wrap">True</property>
+ <property name="spacing">3</property>
+ <child>
+ <widget class="GtkImage" id="image1">
+ <property name="visible">True</property>
+ <property name="stock">gtk-floppy</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Install</property>
+ <property name="use_underline">True</property>
+ </widget>
+ <packing>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
</widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
+ <property name="fill">False</property>
</packing>
</child>
<child>
- <widget class="GtkHBox" id="hbox_filesize">
+ <widget class="GtkButton" id="button_remove">
<property name="visible">True</property>
- <property name="spacing">6</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="response_id">0</property>
<child>
- <widget class="GtkLabel" id="label_filesize_text">
+ <widget class="GtkHBox" id="hbox10">
<property name="visible">True</property>
- <property name="label">Package size:</property>
+ <property name="spacing">3</property>
+ <child>
+ <widget class="GtkImage" id="image3">
+ <property name="visible">True</property>
+ <property name="stock">gtk-delete</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label2">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Remove</property>
+ <property name="use_underline">True</property>
+ </widget>
+ <packing>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
</widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
</child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkButton" id="button_homepage">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="response_id">0</property>
<child>
- <widget class="GtkLabel" id="label_filesize">
+ <widget class="GtkHBox" id="hbox4">
<property name="visible">True</property>
- <property name="label">124kb</property>
+ <property name="spacing">3</property>
+ <child>
+ <widget class="GtkImage" id="image5">
+ <property name="visible">True</property>
+ <property name="stock">gtk-home</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label3">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Website</property>
+ <property name="use_underline">True</property>
+ </widget>
+ <packing>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
</widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
- <property name="position">1</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
</packing>
</child>
</widget>
<packing>
- <property name="position">1</property>
+ <property name="expand">False</property>
</packing>
</child>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <widget class="GtkHButtonBox" id="hbuttonbox1">
- <property name="visible">True</property>
- <property name="layout_style">GTK_BUTTONBOX_START</property>
<child>
- <widget class="GtkButton" id="button_homepage">
+ <widget class="GtkScrolledWindow" id="scrolledwindow2">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="response_id">0</property>
+ <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <property name="shadow_type">GTK_SHADOW_IN</property>
<child>
- <widget class="GtkAlignment" id="alignment26">
+ <widget class="GtkTextView" id="textview_description">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="border_width">2</property>
+ <property name="editable">False</property>
+ <property name="wrap_mode">GTK_WRAP_WORD</property>
+ <property name="cursor_visible">False</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVBox" id="vbox_detail_extra">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkHBox" id="hbox12">
<property name="visible">True</property>
- <property name="xscale">0</property>
- <property name="yscale">0</property>
<child>
- <widget class="GtkHBox" id="hbox30">
+ <widget class="GtkVBox" id="vbox6">
<property name="visible">True</property>
- <property name="spacing">2</property>
<child>
- <widget class="GtkImage" id="image7">
+ <widget class="GtkImage" id="image_icon">
<property name="visible">True</property>
- <property name="stock">gtk-home</property>
+ <property name="stock">gtk-missing-image</property>
+ <property name="icon_size">6</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkVBox" id="vbox5">
+ <property name="visible">True</property>
+ <property name="spacing">3</property>
<child>
- <widget class="GtkLabel" id="label37">
+ <widget class="GtkHBox" id="hbox13">
<property name="visible">True</property>
- <property name="label" translatable="yes">Homepage</property>
- <property name="use_underline">True</property>
+ <child>
+ <widget class="GtkLabel" id="label_source">
+ <property name="visible">True</property>
+ <property name="label">Source: Fedora - Rawhide</property>
+ <property name="wrap">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox14">
+ <property name="visible">True</property>
+ <child>
+ <widget class="GtkLabel" id="label_filesize">
+ <property name="visible">True</property>
+ <property name="label">Download size: 124kb</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="expand">False</property>
- <property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</widget>
+ <packing>
+ <property name="padding">3</property>
+ <property name="position">1</property>
+ </packing>
</child>
</widget>
+ <packing>
+ <property name="padding">6</property>
+ </packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
+ <property name="position">2</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
- <property name="position">2</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
</packing>
</child>
</widget>
- </child>
- <child>
- <widget class="GtkLabel" id="label_tab_description">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Description</property>
- </widget>
- <packing>
- <property name="type">tab</property>
- <property name="tab_fill">False</property>
- </packing>
- </child>
- <child>
- <widget class="GtkVBox" id="vbox_files">
- <property name="visible">True</property>
- <property name="border_width">5</property>
- <child>
- <widget class="GtkScrolledWindow" id="scrolledwindow3">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
- <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
- <property name="shadow_type">GTK_SHADOW_IN</property>
- <child>
- <widget class="GtkTextView" id="textview_files">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="border_width">2</property>
- <property name="editable">False</property>
- <property name="wrap_mode">GTK_WRAP_WORD</property>
- <property name="cursor_visible">False</property>
- </widget>
- </child>
- </widget>
- </child>
- </widget>
<packing>
<property name="position">1</property>
</packing>
</child>
- <child>
- <widget class="GtkLabel" id="label_tab_files">
- <property name="visible">True</property>
- <property name="label" translatable="yes">File List</property>
- </widget>
- <packing>
- <property name="type">tab</property>
- <property name="position">1</property>
- <property name="tab_fill">False</property>
- </packing>
- </child>
- <child>
- <widget class="GtkVBox" id="vbox_depends">
- <property name="visible">True</property>
- <property name="border_width">5</property>
- <child>
- <widget class="GtkScrolledWindow" id="scrolledwindow4">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
- <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
- <property name="shadow_type">GTK_SHADOW_IN</property>
- <child>
- <widget class="GtkTextView" id="textview_depends">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="border_width">2</property>
- <property name="editable">False</property>
- <property name="wrap_mode">GTK_WRAP_WORD</property>
- <property name="cursor_visible">False</property>
- </widget>
- </child>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="position">2</property>
- </packing>
- </child>
- <child>
- <widget class="GtkLabel" id="label34">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Depends on</property>
- </widget>
- <packing>
- <property name="type">tab</property>
- <property name="position">2</property>
- <property name="tab_fill">False</property>
- </packing>
- </child>
- <child>
- <widget class="GtkVBox" id="vbox_requires">
- <property name="visible">True</property>
- <property name="border_width">5</property>
- <child>
- <widget class="GtkScrolledWindow" id="scrolledwindow5">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
- <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
- <property name="shadow_type">GTK_SHADOW_IN</property>
- <child>
- <widget class="GtkTextView" id="textview_requires">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="border_width">2</property>
- <property name="editable">False</property>
- <property name="wrap_mode">GTK_WRAP_WORD</property>
- <property name="cursor_visible">False</property>
- </widget>
- </child>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="position">3</property>
- </packing>
- </child>
- <child>
- <widget class="GtkLabel" id="label_requires">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Required by</property>
- </widget>
- <packing>
- <property name="type">tab</property>
- <property name="position">3</property>
- <property name="tab_fill">False</property>
- </packing>
- </child>
</widget>
<packing>
- <property name="expand">False</property>
+ <property name="padding">6</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkHButtonBox" id="hbuttonbox1">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <property name="layout_style">GTK_BUTTONBOX_END</property>
+ <child>
+ <widget class="GtkButton" id="button_help">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="label" translatable="yes">gtk-help</property>
+ <property name="use_stock">True</property>
+ <property name="response_id">0</property>
+ </widget>
+ <packing>
+ <property name="secondary">True</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkButton" id="button_clear">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="label" translatable="yes">gtk-clear</property>
+ <property name="use_stock">True</property>
+ <property name="response_id">0</property>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkButton" id="button_apply">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="label" translatable="yes">gtk-apply</property>
+ <property name="use_stock">True</property>
+ <property name="response_id">0</property>
+ </widget>
+ <packing>
<property name="position">2</property>
</packing>
</child>
</widget>
<packing>
+ <property name="expand">False</property>
<property name="padding">6</property>
+ <property name="position">1</property>
</packing>
</child>
</widget>
+ <packing>
+ <property name="padding">12</property>
+ </packing>
</child>
</widget>
<packing>
<property name="padding">6</property>
- <property name="position">2</property>
+ <property name="position">1</property>
</packing>
</child>
</widget>
Modified: trunk/po/POTFILES.in
==============================================================================
--- trunk/po/POTFILES.in (original)
+++ trunk/po/POTFILES.in Tue Jun 10 15:23:42 2008
@@ -5,8 +5,11 @@
data/gpk-application.desktop.in
data/gpk-application.glade
data/gpk-backend-status.glade
-data/gpk-install-file.desktop.in
data/gpk-client.glade
+data/gpk-error.glade
+data/gpk-eula.glade
+data/gpk-install-catalog.desktop.in
+data/gpk-install-file.desktop.in
data/gpk-log.desktop.in
data/gpk-log.glade
data/gpk-prefs.desktop.in
@@ -17,22 +20,30 @@
data/gpk-update-icon.desktop.in
data/gpk-update-viewer.desktop.in
data/gpk-update-viewer.glade
-data/gpk-error.glade
-data/gpk-eula.glade
-src/gpk-error.c
-src/gpk-common.c
-src/gpk-client.c
src/gpk-application.c
src/gpk-application-main.c
src/gpk-backend-status.c
-src/gpk-inhibit.c
+src/gpk-check-update.c
+src/gpk-client.c
+src/gpk-client-chooser.c
+src/gpk-client-depends.c
+src/gpk-client-eula.c
+src/gpk-client-requires.c
+src/gpk-client-resolve.c
+src/gpk-client-run.c
+src/gpk-client-signature.c
+src/gpk-client-untrusted.c
+src/gpk-common.c
+src/gpk-consolekit.c
+src/gpk-error.c
src/gpk-firmware.c
+src/gpk-inhibit.c
+src/gpk-install-catalog.c
src/gpk-install-local-file.c
+src/gpk-install-mime-type.c
src/gpk-install-package-name.c
src/gpk-install-provide-file.c
-src/gpk-install-mime-type.c
src/gpk-log.c
-src/gpk-check-update.c
src/gpk-prefs.c
src/gpk-repo.c
src/gpk-smart-icon.c
@@ -40,11 +51,4 @@
src/gpk-update-icon.c
src/gpk-update-viewer.c
src/gpk-watch.c
-src/gpk-consolekit.c
-src/gpk-client-eula.c
-src/gpk-client-depends.c
-src/gpk-client-resolve.c
-src/gpk-client-requires.c
-src/gpk-client-signature.c
-src/gpk-client-untrusted.c
-src/gpk-client-chooser.c
+
Modified: trunk/src/.gitignore
==============================================================================
--- trunk/src/.gitignore (original)
+++ trunk/src/.gitignore Tue Jun 10 15:23:42 2008
@@ -20,6 +20,7 @@
gpk-install-package-name
gpk-install-mime-type
gpk-install-provide-file
+gpk-install-catalog
gpk-prefs
gpk-update-viewer
gpk-backend-status
Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am (original)
+++ trunk/src/Makefile.am Tue Jun 10 15:23:42 2008
@@ -38,6 +38,7 @@
gpk-application \
gpk-repo \
gpk-prefs \
+ gpk-install-catalog \
gpk-install-local-file \
gpk-install-mime-type \
gpk-install-provide-file \
@@ -104,6 +105,15 @@
$(shared_LIBS) \
$(NULL)
+gpk_install_catalog_SOURCES = \
+ gpk-install-catalog.c \
+ $(shared_SOURCES) \
+ $(NULL)
+
+gpk_install_catalog_LDADD = \
+ $(shared_LIBS) \
+ $(NULL)
+
gpk_install_local_file_SOURCES = \
gpk-install-local-file.c \
$(shared_SOURCES) \
@@ -156,6 +166,8 @@
gpk-application-main.c \
gpk-application.c \
gpk-application.h \
+ gpk-application-state.c \
+ gpk-application-state.h \
$(shared_SOURCES) \
$(NULL)
Modified: trunk/src/gpk-application.c
==============================================================================
--- trunk/src/gpk-application.c (original)
+++ trunk/src/gpk-application.c Tue Jun 10 15:23:42 2008
@@ -40,6 +40,7 @@
#include <pk-common.h>
#include <pk-connection.h>
#include <pk-package-id.h>
+#include <pk-package-list.h>
#include <pk-extra.h>
#include <gpk-client.h>
@@ -48,8 +49,10 @@
#include <gpk-error.h>
#include "gpk-application.h"
+#include "gpk-application-state.h"
#include "gpk-animated-icon.h"
-#include <gpk-client-run.h>
+#include "gpk-client-run.h"
+#include "gpk-client-chooser.h"
static void gpk_application_class_init (GpkApplicationClass *klass);
static void gpk_application_init (GpkApplication *application);
@@ -116,9 +119,9 @@
enum
{
PACKAGES_COLUMN_IMAGE,
- PACKAGES_COLUMN_INSTALLED, /* state on disk */
- PACKAGES_COLUMN_SELECTED, /* do we want to change the state */
+ PACKAGES_COLUMN_STATE, /* state of the */
PACKAGES_COLUMN_CHECKBOX, /* what we show in the checkbox */
+ PACKAGES_COLUMN_CHECKBOX_ENABLE, /* sensitive */
PACKAGES_COLUMN_TEXT,
PACKAGES_COLUMN_ID,
PACKAGES_COLUMN_LAST
@@ -242,16 +245,6 @@
}
/**
- * gpk_application_homepage_cb:
- **/
-static void
-gpk_application_homepage_cb (GtkWidget *widget, GpkApplication *application)
-{
- g_return_if_fail (PK_IS_APPLICATION (application));
- gpk_gnome_open (application->priv->url);
-}
-
-/**
* gpk_application_set_text_buffer:
**/
static void
@@ -270,6 +263,261 @@
}
/**
+ * gpk_application_menu_homepage_cb:
+ **/
+static void
+gpk_application_menu_homepage_cb (GtkAction *action, GpkApplication *application)
+{
+ g_return_if_fail (PK_IS_APPLICATION (application));
+ gpk_gnome_open (application->priv->url);
+}
+
+/**
+ * gpk_application_modal_info:
+ **/
+static void
+gpk_application_modal_info (GpkApplication *application, const gchar *title, const gchar *text)
+{
+ GtkWidget *dialog;
+ GtkWidget *widget;
+ GtkWidget *main_window;
+ GtkWidget *scrolled_window;
+
+ g_return_if_fail (PK_IS_APPLICATION (application));
+
+ widget = gtk_text_view_new ();
+ scrolled_window = gtk_scrolled_window_new (NULL, NULL);
+ gtk_widget_set_size_request (scrolled_window, 400, 200);
+ gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_window), widget);
+
+ main_window = glade_xml_get_widget (application->priv->glade_xml, "window_manager");
+ dialog = gtk_dialog_new_with_buttons (title, GTK_WINDOW (main_window),
+ GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_OK,
+ GTK_RESPONSE_NONE, NULL);
+
+ gpk_application_set_text_buffer (widget, text);
+ gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), scrolled_window);
+
+ /* ensure that the dialog box is destroyed when the user responds. */
+ g_signal_connect_swapped (dialog, "response", G_CALLBACK (gtk_widget_destroy), dialog);
+ gtk_widget_show_all (dialog);
+}
+
+/**
+ * gpk_application_menu_files_cb:
+ **/
+static void
+gpk_application_menu_files_cb (GtkAction *action, GpkApplication *application)
+{
+ GError *error = NULL;
+ gchar **files;
+ gchar *text;
+
+ g_return_if_fail (PK_IS_APPLICATION (application));
+
+ files = gpk_client_get_file_list (application->priv->gclient, application->priv->package, &error);
+ if (files == NULL) {
+ pk_warning ("could not get file list: %s", error->message);
+ g_error_free (error);
+ return;
+ }
+
+ /* split and show */
+ text = g_strjoinv ("\n", files);
+
+ if (pk_strzero (text)) {
+ g_free (text);
+ text = g_strdup (_("No files"));
+ }
+
+ gpk_application_modal_info (application, _("File list"), text);
+
+ g_free (text);
+ g_strfreev (files);
+}
+
+static void gpk_application_button_install_cb (GtkWidget *widget_button, GpkApplication *application);
+static void gpk_application_button_remove_cb (GtkWidget *widget_button, GpkApplication *application);
+
+/**
+ * gpk_application_menu_install_cb:
+ **/
+static void
+gpk_application_menu_install_cb (GtkAction *action, GpkApplication *application)
+{
+ gpk_application_button_install_cb (NULL, application);
+}
+
+/**
+ * gpk_application_menu_remove_cb:
+ **/
+static void
+gpk_application_menu_remove_cb (GtkAction *action, GpkApplication *application)
+{
+ gpk_application_button_remove_cb (NULL, application);
+}
+
+/**
+ * gpk_application_menu_run_cb:
+ **/
+static void
+gpk_application_menu_run_cb (GtkAction *action, GpkApplication *application)
+{
+ gchar *exec;
+ GError *error = NULL;
+ gchar **array;
+ GtkTreeView *treeview;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ GtkTreeSelection *selection;
+ GtkWidget *widget;
+ GpkPackageState state;
+ gboolean ret;
+ gchar *package_id = NULL;
+
+ /* get selection */
+ widget = glade_xml_get_widget (application->priv->glade_xml, "treeview_packages");
+ treeview = GTK_TREE_VIEW (widget);
+ selection = gtk_tree_view_get_selection (treeview);
+ ret = gtk_tree_selection_get_selected (selection, &model, &iter);
+ if (!ret) {
+ pk_warning ("no selection");
+ return;
+ }
+
+ /* get item */
+ gtk_tree_model_get (model, &iter,
+ PACKAGES_COLUMN_ID, &package_id,
+ PACKAGES_COLUMN_STATE, &state, -1);
+
+ /* only if installed */
+ if (gpk_application_state_installed (state)) {
+ /* run this single package id */
+ array = g_strsplit (package_id, "|", 1);
+ exec = gpk_client_run_show (array);
+ if (exec != NULL) {
+ ret = g_spawn_command_line_async (exec, &error);
+ if (!ret) {
+ pk_warning ("failed to run: %s", error->message);
+ g_error_free (error);
+ }
+ }
+ g_free (exec);
+ g_strfreev (array);
+ }
+ g_free (package_id);
+}
+
+/**
+ * gpk_application_menu_requires_cb:
+ **/
+static void
+gpk_application_menu_requires_cb (GtkAction *action, GpkApplication *application)
+{
+ GError *error = NULL;
+ gboolean ret;
+ PkPackageList *list;
+ GtkWidget *widget;
+
+ /* cancel any previous request */
+ ret = pk_client_reset (application->priv->client_files, &error);
+ if (!ret) {
+ pk_warning ("failed to cancel, and adding to queue: %s", error->message);
+ g_error_free (error);
+ return;
+ }
+
+ /* get the requires */
+ pk_client_set_synchronous (application->priv->client_files, TRUE, NULL);
+ ret = pk_client_get_requires (application->priv->client_files, PK_FILTER_ENUM_NONE,
+ application->priv->package, TRUE, &error);
+ pk_client_set_synchronous (application->priv->client_files, FALSE, NULL);
+
+ if (!ret) {
+ pk_warning ("failed to get requires: %s", error->message);
+ g_error_free (error);
+ return;
+ }
+
+ list = pk_client_get_package_list (application->priv->client_files);
+ widget = glade_xml_get_widget (application->priv->glade_xml, "window_manager");
+ if (pk_package_list_get_size (list) == 0) {
+ gpk_error_dialog_modal (GTK_WINDOW (widget), _("No packages"),
+ _("This package does not require any others"), NULL);
+ } else {
+ gpk_client_chooser_show (GTK_WINDOW (widget), list, PK_ROLE_ENUM_GET_REQUIRES, _("Required by"));
+ }
+
+ g_object_unref (list);
+}
+
+/**
+ * gpk_application_menu_depends_cb:
+ **/
+static void
+gpk_application_menu_depends_cb (GtkAction *action, GpkApplication *application)
+{
+ GError *error = NULL;
+ gboolean ret;
+ PkPackageList *list;
+ GtkWidget *widget;
+
+ /* cancel any previous request */
+ ret = pk_client_reset (application->priv->client_files, &error);
+ if (!ret) {
+ pk_warning ("failed to cancel, and adding to queue: %s", error->message);
+ g_error_free (error);
+ return;
+ }
+
+ /* get the depends */
+ pk_client_set_synchronous (application->priv->client_files, TRUE, NULL);
+ ret = pk_client_get_depends (application->priv->client_files, PK_FILTER_ENUM_NONE,
+ application->priv->package, TRUE, &error);
+ pk_client_set_synchronous (application->priv->client_files, FALSE, NULL);
+
+ if (!ret) {
+ pk_warning ("failed to get depends: %s", error->message);
+ g_error_free (error);
+ return;
+ }
+
+ list = pk_client_get_package_list (application->priv->client_files);
+ widget = glade_xml_get_widget (application->priv->glade_xml, "window_manager");
+ if (pk_package_list_get_size (list) == 0) {
+ gpk_error_dialog_modal (GTK_WINDOW (widget), _("No packages"),
+ _("This package does not depends on any others"), NULL);
+ } else {
+ gpk_client_chooser_show (GTK_WINDOW (widget), list, PK_ROLE_ENUM_GET_DEPENDS, _("Depends on"));
+ }
+
+ g_object_unref (list);
+}
+
+/**
+ * gpk_application_get_full_repo_name:
+ **/
+static const gchar *
+gpk_application_get_full_repo_name (GpkApplication *application, const gchar *data)
+{
+ const gchar *repo_name;
+
+ /* if no data, we can't look up in the hash table */
+ if (pk_strzero (data)) {
+ pk_warning ("no ident data");
+ return _("Invalid");
+ }
+
+ /* try to find in cached repo list */
+ repo_name = (const gchar *) g_hash_table_lookup (application->priv->repos, data);
+ if (repo_name == NULL) {
+ pk_warning ("no repo name, falling back to %s", data);
+ return data;
+ }
+ return repo_name;
+}
+
+/**
* gpk_application_details_cb:
**/
static void
@@ -280,28 +528,32 @@
{
GtkWidget *widget;
gchar *text;
+ gchar *value;
PkPackageId *ident;
const gchar *repo_name;
const gchar *icon;
- gboolean valid = FALSE;
+ gboolean valid;
gboolean installed;
PkInfoEnum info;
g_return_if_fail (PK_IS_APPLICATION (application));
ident = pk_package_id_new_from_string (package_id);
+ if (ident == NULL) {
+ pk_warning ("failed to get PkPackageId for %s", package_id);
+ return;
+ }
installed = pk_strequal (ident->data, "installed");
pk_debug ("details = %s:%i:%s:%s", package_id, group, detail, url);
- widget = glade_xml_get_widget (application->priv->glade_xml, "notebook_description");
+ widget = glade_xml_get_widget (application->priv->glade_xml, "vbox_detail_extra");
gtk_widget_show (widget);
/* get the icon */
icon = pk_extra_get_icon_name (application->priv->extra, ident->name);
- if (icon != NULL) {
- /* check icon actually exists and is valid in this theme */
- valid = gpk_check_icon_valid (icon);
- }
+
+ /* check icon actually exists and is valid in this theme */
+ valid = gpk_check_icon_valid (icon);
/* nothing in the detail database or invalid */
if (valid == FALSE) {
@@ -310,22 +562,27 @@
}
widget = glade_xml_get_widget (application->priv->glade_xml, "image_icon");
gtk_image_set_from_icon_name (GTK_IMAGE (widget), icon, GTK_ICON_SIZE_DIALOG);
+ gtk_widget_show (widget);
- /* homepage button? */
- widget = glade_xml_get_widget (application->priv->glade_xml, "button_homepage");
+ /* homepage */
+ widget = glade_xml_get_widget (application->priv->glade_xml, "menuitem_homepage");
if (pk_strzero (url) == FALSE) {
- gtk_widget_show (widget);
+ gtk_widget_set_sensitive (widget, TRUE);
g_free (application->priv->url);
/* save the url for the button */
application->priv->url = g_strdup (url);
/* set the tooltip to where we are going */
text = g_strdup_printf (_("Visit %s"), url);
- widget = glade_xml_get_widget (application->priv->glade_xml, "button_homepage");
gtk_widget_set_tooltip_text (widget, text);
g_free (text);
+
+ widget = glade_xml_get_widget (application->priv->glade_xml, "button_homepage");
+ gtk_widget_set_sensitive (widget, TRUE);
} else {
- gtk_widget_hide (widget);
+ gtk_widget_set_sensitive (widget, FALSE);
+ widget = glade_xml_get_widget (application->priv->glade_xml, "button_homepage");
+ gtk_widget_set_sensitive (widget, FALSE);
}
/* set the description */
@@ -334,83 +591,52 @@
gpk_application_set_text_buffer (widget, text);
g_free (text);
+ widget = glade_xml_get_widget (application->priv->glade_xml, "vbox_detail_extra");
+ gtk_widget_hide (widget);
+
/* if non-zero, set the size */
if (size > 0) {
- gchar *value;
-
- /* change the label */
- widget = glade_xml_get_widget (application->priv->glade_xml, "label_filesize_text");
- if (installed) {
- gtk_label_set_label (GTK_LABEL (widget), _("Installed size:"));
- } else {
- gtk_label_set_label (GTK_LABEL (widget), _("Download size:"));
- }
-
/* set the size */
widget = glade_xml_get_widget (application->priv->glade_xml, "label_filesize");
value = gpk_size_to_si_size_text (size);
- gtk_label_set_label (GTK_LABEL (widget), value);
+ if (installed) {
+ text = g_strdup_printf (_("Installed size: %s"), value);
+ } else {
+ text = g_strdup_printf (_("Download size: %s"), value);
+ }
+ gtk_label_set_label (GTK_LABEL (widget), text);
+ g_free (text);
g_free (value);
- widget = glade_xml_get_widget (application->priv->glade_xml, "hbox_filesize");
+ gtk_widget_show (widget);
+
+ /* and the containter */
+ widget = glade_xml_get_widget (application->priv->glade_xml, "vbox_detail_extra");
gtk_widget_show (widget);
} else {
- widget = glade_xml_get_widget (application->priv->glade_xml, "hbox_filesize");
+ widget = glade_xml_get_widget (application->priv->glade_xml, "label_filesize");
gtk_widget_hide (widget);
}
/* set the repo text, or hide if installed */
if (installed) {
- widget = glade_xml_get_widget (application->priv->glade_xml, "hbox_source");
+ widget = glade_xml_get_widget (application->priv->glade_xml, "label_source");
gtk_widget_hide (widget);
} else {
- widget = glade_xml_get_widget (application->priv->glade_xml, "hbox_source");
- gtk_widget_show (widget);
widget = glade_xml_get_widget (application->priv->glade_xml, "label_source");
+ gtk_widget_show (widget);
/* see if we can get the full name of the repo from the repo_id */
- repo_name = (const gchar *) g_hash_table_lookup (application->priv->repos, ident->data);
- if (repo_name == NULL) {
- pk_warning ("no repo name, falling back to %s", ident->data);
- repo_name = ident->data;
- }
- gtk_label_set_label (GTK_LABEL (widget), repo_name);
- }
- pk_package_id_free (ident);
-}
-
-/**
- * gpk_application_files_cb:
- **/
-static void
-gpk_application_files_cb (PkClient *client, const gchar *package_id,
- const gchar *filelist, GpkApplication *application)
-{
- GtkWidget *widget;
-
- g_return_if_fail (PK_IS_APPLICATION (application));
-
- widget = glade_xml_get_widget (application->priv->glade_xml, "notebook_description");
- gtk_widget_show (widget);
-
- /* set the text box */
- widget = glade_xml_get_widget (application->priv->glade_xml, "textview_files");
- /* ITS4: ignore, not used for allocation */
- if (pk_strzero (filelist) == FALSE) {
- gchar *list;
- gchar **array;
- /* replace the ; with a newline */
- array = g_strsplit (filelist, ";", 0);
- list = g_strjoinv ("\n", array);
+ repo_name = gpk_application_get_full_repo_name (application, ident->data);
+ text = g_strdup_printf (_("Source: %s"), repo_name);
+ gtk_label_set_label (GTK_LABEL (widget), text);
+ g_free (text);
- /* apply the list */
- gpk_application_set_text_buffer (widget, list);
- g_strfreev (array);
- g_free (list);
- } else {
- /* no information */
- gpk_application_set_text_buffer (widget, _("No files"));
+ /* and the containter */
+ widget = glade_xml_get_widget (application->priv->glade_xml, "vbox_detail_extra");
+ gtk_widget_show (widget);
}
+ pk_package_id_free (ident);
}
static gint
@@ -453,39 +679,24 @@
}
/**
- * gpk_application_get_icon:
+ * gpk_application_get_checkbox_enable:
**/
-static const gchar *
-gpk_application_get_icon (gboolean in_queue, gboolean installed)
+static gboolean
+gpk_application_get_checkbox_enable (GpkApplication *application, GpkPackageState state)
{
- if (!in_queue) {
- /* trivial case, not in list and installed */
- if (installed) {
- return gpk_info_enum_to_icon_name (PK_INFO_ENUM_INSTALLED);
- }
- /* not in list and not installed */
- return gpk_info_enum_to_icon_name (PK_INFO_ENUM_AVAILABLE);
- }
+ gboolean enable_installed = TRUE;
+ gboolean enable_available = TRUE;
- /* installed, and queued to be removed */
- if (installed) {
- return gpk_info_enum_to_icon_name (PK_INFO_ENUM_REMOVING);
+ if (application->priv->action == PK_ACTION_INSTALL) {
+ enable_installed = FALSE;
+ } else if (application->priv->action == PK_ACTION_REMOVE) {
+ enable_available = FALSE;
}
- /* available, and queued to be added */
- return gpk_info_enum_to_icon_name (PK_INFO_ENUM_INSTALLING);
-}
-/**
- * gpk_application_get_checkbox:
- **/
-static gboolean
-gpk_application_get_checkbox (gboolean in_queue, gboolean installed)
-{
- /* common case */
- if (!in_queue) {
- return installed;
+ if (gpk_application_state_installed (state)) {
+ return enable_installed;
}
- return !installed;
+ return enable_available;
}
/**
@@ -504,6 +715,8 @@
gboolean in_queue;
gboolean installed;
gboolean checkbox;
+ gboolean enabled;
+ GpkPackageState state = 0;
g_return_if_fail (PK_IS_APPLICATION (application));
@@ -514,34 +727,50 @@
return;
}
- /* mark as got so we don't warn */
- application->priv->has_package = TRUE;
-
/* find localised summary */
ident = pk_package_id_new_from_string (package_id);
+ if (ident == NULL) {
+ pk_warning ("failed to get PkPackageId for %s", package_id);
+ return;
+ }
summary_new = pk_extra_get_summary (application->priv->extra, ident->name);
if (summary_new == NULL) {
/* use the non-localised one */
summary_new = summary;
}
+ /* mark as got so we don't warn */
+ application->priv->has_package = TRUE;
/* are we in the package list? */
index = pk_ptr_array_find_string (application->priv->package_list, package_id);
in_queue = (index != -1);
installed = (info == PK_INFO_ENUM_INSTALLED);
- icon = gpk_application_get_icon (in_queue, installed);
- checkbox = gpk_application_get_checkbox (in_queue, installed);
+ if (installed && in_queue) {
+ state = GPK_STATE_INSTALLED_TO_BE_REMOVED;
+ } else if (installed && !in_queue) {
+ state = GPK_STATE_INSTALLED;
+ } else if (!installed && in_queue) {
+ state = GPK_STATE_AVAILABLE_TO_BE_INSTALLED;
+ } else if (!installed && !in_queue) {
+ state = GPK_STATE_AVAILABLE;
+ }
+
+ icon = gpk_application_state_get_icon (state);
+ checkbox = gpk_application_state_get_checkbox (state);
/* use two lines */
text = gpk_package_id_format_twoline (package_id, summary);
+ /* can we modify this? */
+ enabled = gpk_application_get_checkbox_enable (application, state);
+
gtk_list_store_append (application->priv->packages_store, &iter);
gtk_list_store_set (application->priv->packages_store, &iter,
- PACKAGES_COLUMN_INSTALLED, checkbox,
- PACKAGES_COLUMN_SELECTED, in_queue,
+ PACKAGES_COLUMN_STATE, state,
PACKAGES_COLUMN_CHECKBOX, installed ^ in_queue,
+ PACKAGES_COLUMN_CHECKBOX_ENABLE, enabled,
PACKAGES_COLUMN_TEXT, text,
PACKAGES_COLUMN_ID, package_id,
PACKAGES_COLUMN_IMAGE, icon,
@@ -575,42 +804,6 @@
}
/**
- * gpk_application_package_buffer_to_name_version:
- **/
-static gchar *
-gpk_application_package_buffer_to_name_version (PkPackageList *list)
-{
- guint i;
- PkPackageItem *item;
- gchar *text_pretty;
- guint length;
- GString *string;
- gchar *text;
-
- /* sort the list */
- pk_package_list_sort (list);
-
- length = pk_package_list_get_size (list);
- if (length == 0) {
- text = g_strdup ("No packages");
- goto out;
- }
-
- string = g_string_new ("");
- for (i=0; i<length; i++) {
- item = pk_package_list_get_item (list, i);
- /* just use the name */
- text_pretty = gpk_package_id_name_version (item->package_id);
- g_string_append_printf (string, "%s\n", text_pretty);
- g_free (text_pretty);
- }
- g_string_set_size (string, string->len - 1);
- text = g_string_free (string, FALSE);
-out:
- return text;
-}
-
-/**
* gpk_application_refresh_search_results:
**/
static gboolean
@@ -637,8 +830,10 @@
}
/* hide details */
- widget = glade_xml_get_widget (application->priv->glade_xml, "notebook_description");
+ widget = glade_xml_get_widget (application->priv->glade_xml, "vbox_detail_extra");
gtk_widget_hide (widget);
+ widget = glade_xml_get_widget (application->priv->glade_xml, "button_homepage");
+ gtk_widget_set_sensitive (widget, FALSE);
return TRUE;
}
@@ -650,29 +845,11 @@
{
GtkWidget *widget;
PkRoleEnum role;
- gchar *text;
- PkPackageList *list;
g_return_if_fail (PK_IS_APPLICATION (application));
/* get role */
pk_client_get_role (client, &role, NULL, NULL);
- /* do we need to fill in the tab box? */
- if (role == PK_ROLE_ENUM_GET_DEPENDS) {
- list = pk_client_get_package_list (client);
- text = gpk_application_package_buffer_to_name_version (list);
- g_object_unref (list);
- widget = glade_xml_get_widget (application->priv->glade_xml, "textview_depends");
- gpk_application_set_text_buffer (widget, text);
- g_free (text);
- } else if (role == PK_ROLE_ENUM_GET_REQUIRES) {
- list = pk_client_get_package_list (client);
- text = gpk_application_package_buffer_to_name_version (list);
- g_object_unref (list);
- widget = glade_xml_get_widget (application->priv->glade_xml, "textview_requires");
- gpk_application_set_text_buffer (widget, text);
- g_free (text);
- }
if (role == PK_ROLE_ENUM_SEARCH_NAME ||
role == PK_ROLE_ENUM_SEARCH_DETAILS ||
@@ -687,9 +864,9 @@
GtkTreeIter iter;
gtk_list_store_append (application->priv->packages_store, &iter);
gtk_list_store_set (application->priv->packages_store, &iter,
- PACKAGES_COLUMN_INSTALLED, FALSE,
- PACKAGES_COLUMN_SELECTED, FALSE,
+ PACKAGES_COLUMN_STATE, FALSE,
PACKAGES_COLUMN_CHECKBOX, FALSE,
+ PACKAGES_COLUMN_CHECKBOX_ENABLE, FALSE,
PACKAGES_COLUMN_TEXT, _("No results were found"),
PACKAGES_COLUMN_IMAGE, "search",
-1);
@@ -797,8 +974,10 @@
application->priv->has_package = FALSE;
/* hide details */
- widget = glade_xml_get_widget (application->priv->glade_xml, "notebook_description");
+ widget = glade_xml_get_widget (application->priv->glade_xml, "vbox_detail_extra");
gtk_widget_hide (widget);
+ widget = glade_xml_get_widget (application->priv->glade_xml, "button_homepage");
+ gtk_widget_set_sensitive (widget, FALSE);
/* switch around buttons */
gpk_application_set_find_cancel_buttons (application, FALSE);
@@ -976,149 +1155,221 @@
}
/**
- * gpk_application_set_button_actions:
+ * gpk_application_set_buttons_apply_clear:
**/
static void
-gpk_application_set_button_actions (GpkApplication *application)
+gpk_application_set_buttons_apply_clear (GpkApplication *application)
{
GtkWidget *widget;
+ GtkTreeView *treeview;
+ gboolean valid;
+ GtkTreeIter iter;
+ GtkTreeModel *model;
+ GpkPackageState state;
+ gboolean enabled;
g_return_if_fail (PK_IS_APPLICATION (application));
- /* set label */
- if (application->priv->action == PK_ACTION_INSTALL) {
- widget = glade_xml_get_widget (application->priv->glade_xml, "toolbutton_list_show");
- gtk_widget_set_sensitive (widget, TRUE);
- widget = glade_xml_get_widget (application->priv->glade_xml, "toolbutton_list_clear");
- gtk_widget_set_sensitive (widget, TRUE);
- widget = glade_xml_get_widget (application->priv->glade_xml, "toolbutton_install");
- gtk_widget_set_sensitive (widget, TRUE);
- widget = glade_xml_get_widget (application->priv->glade_xml, "toolbutton_remove");
+ /* okay to apply? */
+ if (application->priv->package_list->len == 0) {
+ widget = glade_xml_get_widget (application->priv->glade_xml, "button_apply");
gtk_widget_set_sensitive (widget, FALSE);
- } else if (application->priv->action == PK_ACTION_REMOVE) {
- widget = glade_xml_get_widget (application->priv->glade_xml, "toolbutton_list_show");
- gtk_widget_set_sensitive (widget, TRUE);
- widget = glade_xml_get_widget (application->priv->glade_xml, "toolbutton_list_clear");
- gtk_widget_set_sensitive (widget, TRUE);
- widget = glade_xml_get_widget (application->priv->glade_xml, "toolbutton_install");
+ widget = glade_xml_get_widget (application->priv->glade_xml, "button_clear");
gtk_widget_set_sensitive (widget, FALSE);
- widget = glade_xml_get_widget (application->priv->glade_xml, "toolbutton_remove");
- gtk_widget_set_sensitive (widget, TRUE);
+ application->priv->action = PK_ACTION_NONE;
} else {
- widget = glade_xml_get_widget (application->priv->glade_xml, "toolbutton_list_show");
- gtk_widget_set_sensitive (widget, FALSE);
- widget = glade_xml_get_widget (application->priv->glade_xml, "toolbutton_list_clear");
- gtk_widget_set_sensitive (widget, FALSE);
- widget = glade_xml_get_widget (application->priv->glade_xml, "toolbutton_install");
- gtk_widget_set_sensitive (widget, FALSE);
- widget = glade_xml_get_widget (application->priv->glade_xml, "toolbutton_remove");
- gtk_widget_set_sensitive (widget, FALSE);
+ widget = glade_xml_get_widget (application->priv->glade_xml, "button_apply");
+ gtk_widget_set_sensitive (widget, TRUE);
+ widget = glade_xml_get_widget (application->priv->glade_xml, "button_clear");
+ gtk_widget_set_sensitive (widget, TRUE);
+ }
+
+ /* correct the enabled state */
+ widget = glade_xml_get_widget (application->priv->glade_xml, "treeview_packages");
+ treeview = GTK_TREE_VIEW (widget);
+ model = gtk_tree_view_get_model (treeview);
+ valid = gtk_tree_model_get_iter_first (model, &iter);
+
+ /* for all current items, reset the state if in the list */
+ while (valid) {
+ gtk_tree_model_get (model, &iter, PACKAGES_COLUMN_STATE, &state, -1);
+ enabled = gpk_application_get_checkbox_enable (application, state);
+ gtk_list_store_set (GTK_LIST_STORE (model), &iter, PACKAGES_COLUMN_CHECKBOX_ENABLE, enabled, -1);
+ valid = gtk_tree_model_iter_next (model, &iter);
+ }
+}
+
+/**
+ * gpk_application_packages_checkbox_invert:
+ **/
+static void
+gpk_application_packages_checkbox_invert (GpkApplication *application)
+{
+ GtkTreeView *treeview;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ GtkTreeSelection *selection;
+ GtkWidget *widget;
+ const gchar *icon;
+ gboolean checkbox;
+ GpkPackageState state;
+ gboolean ret;
+
+ /* get the selection and add */
+ widget = glade_xml_get_widget (application->priv->glade_xml, "treeview_packages");
+ treeview = GTK_TREE_VIEW (widget);
+ selection = gtk_tree_view_get_selection (treeview);
+ ret = gtk_tree_selection_get_selected (selection, &model, &iter);
+ if (!ret) {
+ pk_warning ("no selection");
+ return;
+ }
+
+ gtk_tree_model_get (model, &iter, PACKAGES_COLUMN_STATE, &state, -1);
+
+ /* do something with the value */
+ gpk_application_state_invert (&state);
+
+ /* get the new icon */
+ icon = gpk_application_state_get_icon (state);
+ checkbox = gpk_application_state_get_checkbox (state);
+
+ /* set new value */
+ gtk_list_store_set (GTK_LIST_STORE (model), &iter,
+ PACKAGES_COLUMN_STATE, state,
+ PACKAGES_COLUMN_CHECKBOX, checkbox,
+ PACKAGES_COLUMN_IMAGE, icon,
+ -1);
+}
+
+/**
+ * gpk_application_allow_install:
+ **/
+static void
+gpk_application_allow_install (GpkApplication *application, gboolean allow)
+{
+ GtkWidget *widget;
+
+ widget = glade_xml_get_widget (application->priv->glade_xml, "button_install");
+ gtk_widget_set_sensitive (widget, allow);
+ widget = glade_xml_get_widget (application->priv->glade_xml, "menuitem_install");
+ gtk_widget_set_sensitive (widget, allow);
+}
+
+/**
+ * gpk_application_allow_remove:
+ **/
+static void
+gpk_application_allow_remove (GpkApplication *application, gboolean allow)
+{
+ GtkWidget *widget;
+
+ widget = glade_xml_get_widget (application->priv->glade_xml, "button_remove");
+ gtk_widget_set_sensitive (widget, allow);
+ widget = glade_xml_get_widget (application->priv->glade_xml, "menuitem_remove");
+ gtk_widget_set_sensitive (widget, allow);
+}
+
+/**
+ * gpk_application_button_remove_cb:
+ **/
+static void
+gpk_application_button_remove_cb (GtkWidget *widget_button, GpkApplication *application)
+{
+ gboolean ret;
+ guint index;
+
+ g_return_if_fail (PK_IS_APPLICATION (application));
+
+ /* shouldn't be possible */
+ if (application->priv->package == NULL) {
+ pk_warning ("no package");
+ return;
+ }
+
+ /* changed mind, or wrong mode */
+ if (application->priv->action == PK_ACTION_INSTALL) {
+ ret = pk_ptr_array_remove_string (application->priv->package_list, application->priv->package);
+ if (ret) {
+ pk_debug ("removed %s from package list", application->priv->package);
+
+ /* correct buttons */
+ gpk_application_allow_install (application, TRUE);
+ gpk_application_allow_remove (application, FALSE);
+ gpk_application_packages_checkbox_invert (application);
+ gpk_application_set_buttons_apply_clear (application);
+ return;
+ }
+ pk_warning ("wrong mode and not in list");
+ return;
}
+
+ /* already added */
+ index = pk_ptr_array_find_string (application->priv->package_list, application->priv->package);
+ if (index != -1) {
+ pk_warning ("already added");
+ return;
+ }
+
+ application->priv->action = PK_ACTION_REMOVE;
+ g_ptr_array_add (application->priv->package_list, g_strdup (application->priv->package));
+
+ /* correct buttons */
+ gpk_application_allow_install (application, TRUE);
+ gpk_application_allow_remove (application, FALSE);
+ gpk_application_packages_checkbox_invert (application);
+ gpk_application_set_buttons_apply_clear (application);
}
/**
- * gpk_application_packages_add_selection:
+ * gpk_application_button_install_cb:
**/
static void
-gpk_application_packages_add_selection (GpkApplication *application, GtkTreeModel *model, GtkTreeIter iter)
+gpk_application_button_install_cb (GtkWidget *widget_button, GpkApplication *application)
{
- gboolean installed;
- gboolean selected;
- gboolean is_in_list = FALSE;
gboolean ret;
- gboolean checkbox;
- gchar *package_id = NULL;
- gchar *message;
- const gchar *icon;
- GtkWidget *widget;
+ guint index;
- gtk_tree_model_get (model, &iter,
- PACKAGES_COLUMN_INSTALLED, &installed,
- PACKAGES_COLUMN_SELECTED, &selected,
- PACKAGES_COLUMN_CHECKBOX, &checkbox,
- PACKAGES_COLUMN_ID, &package_id, -1);
-
- if (application->priv->action == PK_ACTION_REMOVE && !checkbox) {
- /* is it in the package list and we want to deselect it? */
- ret = pk_ptr_array_remove_string (application->priv->package_list, package_id);
- if (ret) {
- pk_debug ("removed %s from package list", package_id);
- goto set_new_value;
- }
- /* wrong action type */
- message = g_strdup_printf ("%s\n%s\n%s",
- _("There are already packages queued to be removed."),
- _("Click 'Clear list' to remove the previous selection or "
- "'Remove packages' to complete the previous action."),
- _("After completing the action new packages can be selected to be installed."));
- widget = glade_xml_get_widget (application->priv->glade_xml, "window_manager");
- gpk_error_dialog_modal (GTK_WINDOW (widget), _("Already selected packages to be removed"), message, NULL);
- g_free (message);
- pk_warning ("ignoring action as ACTION=REMOVE and not in list");
- goto out;
+ g_return_if_fail (PK_IS_APPLICATION (application));
+
+ /* shouldn't be possible */
+ if (application->priv->package == NULL) {
+ pk_warning ("no package");
+ return;
}
- if (application->priv->action == PK_ACTION_INSTALL && checkbox) {
- /* is it in the package list and we want to deselect it? */
- ret = pk_ptr_array_remove_string (application->priv->package_list, package_id);
+ /* changed mind, or wrong mode */
+ if (application->priv->action == PK_ACTION_REMOVE) {
+ ret = pk_ptr_array_remove_string (application->priv->package_list, application->priv->package);
if (ret) {
- pk_debug ("removed %s from package list", package_id);
- goto set_new_value;
- }
- /* wrong action type */
- message = g_strdup_printf ("%s\n%s\n%s",
- _("There are already packages queued to be installed."),
- _("Click 'Clear list' to remove the previous selection or "
- "'Install packages' to complete the previous action."),
- _("After completing the action new packages can be selected to be removed."));
- widget = glade_xml_get_widget (application->priv->glade_xml, "window_manager");
- gpk_error_dialog_modal (GTK_WINDOW (widget), _("Already selected packages to be installed"), message, NULL);
- g_free (message);
- pk_warning ("ignoring action as ACTION=INSTALL");
- goto out;
- }
+ pk_debug ("removed %s from package list", application->priv->package);
- /* set new action if undecided */
- if (application->priv->action == PK_ACTION_NONE && checkbox) {
- application->priv->action = PK_ACTION_REMOVE;
- gpk_application_set_button_actions (application);
- }
- if (application->priv->action == PK_ACTION_NONE && !checkbox) {
- application->priv->action = PK_ACTION_INSTALL;
- gpk_application_set_button_actions (application);
+ /* correct buttons */
+ gpk_application_allow_install (application, FALSE);
+ gpk_application_allow_remove (application, TRUE);
+ gpk_application_packages_checkbox_invert (application);
+ gpk_application_set_buttons_apply_clear (application);
+ return;
+ }
+ pk_warning ("wrong mode and not in list");
+ return;
}
- if (application->priv->action == PK_ACTION_REMOVE) {
- pk_debug ("add to remove list %s", package_id);
- g_ptr_array_add (application->priv->package_list, g_strdup (package_id));
- is_in_list = TRUE;
- }
- if (application->priv->action == PK_ACTION_INSTALL) {
- pk_debug ("add to install list %s", package_id);
- g_ptr_array_add (application->priv->package_list, g_strdup (package_id));
- is_in_list = TRUE;
+ /* already added */
+ index = pk_ptr_array_find_string (application->priv->package_list, application->priv->package);
+ if (index != -1) {
+ pk_warning ("already added");
+ return;
}
-set_new_value:
- /* do something with the value */
- selected ^= 1;
-
- /* get the new icon */
- icon = gpk_application_get_icon (selected, installed);
-
- /* set new value */
- gtk_list_store_set (GTK_LIST_STORE (model), &iter,
- PACKAGES_COLUMN_SELECTED, selected,
- PACKAGES_COLUMN_CHECKBOX, installed ^ selected,
- PACKAGES_COLUMN_IMAGE, icon,
- -1);
+ application->priv->action = PK_ACTION_INSTALL;
+ g_ptr_array_add (application->priv->package_list, g_strdup (application->priv->package));
- if (application->priv->package_list->len == 0) {
- application->priv->action = PK_ACTION_NONE;
- gpk_application_set_button_actions (application);
- }
-out:
- g_free (package_id);
+ /* correct buttons */
+ gpk_application_allow_install (application, FALSE);
+ gpk_application_allow_remove (application, TRUE);
+ gpk_application_packages_checkbox_invert (application);
+ gpk_application_set_buttons_apply_clear (application);
}
/**
@@ -1133,6 +1384,8 @@
GtkTreeModel *model;
GtkTreeIter iter;
GtkTreePath *path;
+ GtkTreeSelection *selection;
+ GpkPackageState state;
g_return_if_fail (PK_IS_APPLICATION (application));
@@ -1143,54 +1396,41 @@
/* get toggled iter */
gtk_tree_model_get_iter (model, &iter, path);
- gpk_application_packages_add_selection (application, model, iter);
- gtk_tree_path_free (path);
-}
-
-/**
- * gpk_application_button_list_add_cb:
- **/
-static void
-gpk_application_button_list_add_cb (GtkWidget *widget_button, GpkApplication *application)
-{
- GtkTreeSelection *selection;
- GtkWidget *widget;
- GtkTreeView *treeview;
- GtkTreeModel *model;
- GtkTreeIter iter;
+ g_free (application->priv->package);
+ gtk_tree_model_get (model, &iter,
+ PACKAGES_COLUMN_STATE, &state,
+ PACKAGES_COLUMN_ID, &application->priv->package, -1);
- g_return_if_fail (PK_IS_APPLICATION (application));
+ /* enforce the selection in case we just fire at the checkbox without selecting */
+ selection = gtk_tree_view_get_selection (treeview);
+ gtk_tree_selection_select_iter (selection, &iter);
- if (application->priv->package == NULL) {
- widget = glade_xml_get_widget (application->priv->glade_xml, "window_manager");
- gpk_error_dialog_modal (GTK_WINDOW (widget), _("Cannot add package"), _("There is no package selected"), NULL);
- return;
+ if (gpk_application_state_get_checkbox (state)) {
+ gpk_application_button_remove_cb (NULL, application);
+ } else {
+ gpk_application_button_install_cb (NULL, application);
}
-
- /* get the selection and add */
- widget = glade_xml_get_widget (application->priv->glade_xml, "treeview_packages");
- treeview = GTK_TREE_VIEW (widget);
- selection = gtk_tree_view_get_selection (treeview);
- gtk_tree_selection_get_selected (selection, &model, &iter);
- gpk_application_packages_add_selection (application, model, iter);
+ gtk_tree_path_free (path);
}
+static void gpk_application_packages_treeview_clicked_cb (GtkTreeSelection *selection, GpkApplication *application);
+
/**
- * gpk_application_button_list_clear_cb:
+ * gpk_application_button_clear_cb:
**/
static void
-gpk_application_button_list_clear_cb (GtkWidget *widget_button, GpkApplication *application)
+gpk_application_button_clear_cb (GtkWidget *widget_button, GpkApplication *application)
{
GtkTreeView *treeview;
- gint index;
gboolean valid;
- gboolean selected;
- gboolean installed;
+ gboolean checkbox;
GtkWidget *widget;
GtkTreeIter iter;
GtkTreeModel *model;
+ GtkTreeSelection *selection;
const gchar *icon;
- gchar *package_id;
+ GpkPackageState state;
+ gboolean ret;
g_return_if_fail (PK_IS_APPLICATION (application));
@@ -1202,38 +1442,48 @@
/* for all current items, reset the state if in the list */
while (valid) {
- gtk_tree_model_get (model, &iter,
- PACKAGES_COLUMN_INSTALLED, &installed,
- PACKAGES_COLUMN_SELECTED, &selected,
- PACKAGES_COLUMN_ID, &package_id, -1);
- if (selected) {
- index = pk_ptr_array_find_string (application->priv->package_list, package_id);
- if (index != -1) {
- /* get the new icon */
- icon = gpk_application_get_icon (FALSE, installed);
-
- /* set new value */
- gtk_list_store_set (GTK_LIST_STORE (model), &iter,
- PACKAGES_COLUMN_SELECTED, FALSE,
- PACKAGES_COLUMN_CHECKBOX, installed,
- PACKAGES_COLUMN_IMAGE, icon,
- -1);
- }
+ gtk_tree_model_get (model, &iter, PACKAGES_COLUMN_STATE, &state, -1);
+ ret = gpk_application_state_unselect (&state);
+ if (ret) {
+ /* get the new icon */
+ icon = gpk_application_state_get_icon (state);
+ checkbox = gpk_application_state_get_checkbox (state);
+
+ /* set new value */
+ gtk_list_store_set (GTK_LIST_STORE (model), &iter,
+ PACKAGES_COLUMN_STATE, state,
+ PACKAGES_COLUMN_CHECKBOX, checkbox,
+ PACKAGES_COLUMN_IMAGE, icon,
+ -1);
}
- g_free (package_id);
valid = gtk_tree_model_iter_next (model, &iter);
}
g_ptr_array_remove_range (application->priv->package_list, 0, application->priv->package_list->len);
- application->priv->action = PK_ACTION_NONE;
- gpk_application_set_button_actions (application);
+
+ /* force a button refresh */
+ widget = glade_xml_get_widget (application->priv->glade_xml, "treeview_packages");
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (widget));
+ gpk_application_packages_treeview_clicked_cb (selection, application);
+
+ gpk_application_set_buttons_apply_clear (application);
+}
+
+/**
+ * gpk_application_button_homepage_cb:
+ **/
+static void
+gpk_application_button_homepage_cb (GtkWidget *widget_button, GpkApplication *application)
+{
+ g_return_if_fail (PK_IS_APPLICATION (application));
+ gpk_gnome_open (application->priv->url);
}
/**
- * gpk_application_button_install_remove_cb:
+ * gpk_application_button_apply_cb:
**/
static void
-gpk_application_button_install_remove_cb (GtkWidget *widget, GpkApplication *application)
+gpk_application_button_apply_cb (GtkWidget *widget, GpkApplication *application)
{
gboolean ret = FALSE;
GError *error = NULL;
@@ -1268,7 +1518,7 @@
/* clear if success */
g_ptr_array_remove_range (application->priv->package_list, 0, application->priv->package_list->len);
application->priv->action = PK_ACTION_NONE;
- gpk_application_set_button_actions (application);
+ gpk_application_set_buttons_apply_clear (application);
gpk_application_refresh_search_results (application);
}
}
@@ -1289,10 +1539,11 @@
/* column for installed toggles */
renderer = gtk_cell_renderer_toggle_new ();
g_signal_connect (renderer, "toggled", G_CALLBACK (gpk_application_packages_installed_clicked_cb), application);
- column = gtk_tree_view_column_new_with_attributes (_("Installed"), renderer, "active", PACKAGES_COLUMN_CHECKBOX, NULL);
+ column = gtk_tree_view_column_new_with_attributes (_("Installed"), renderer,
+ "active", PACKAGES_COLUMN_CHECKBOX,
+ "visible", PACKAGES_COLUMN_CHECKBOX_ENABLE, NULL);
gtk_tree_view_append_column (treeview, column);
-
/* column for images */
column = gtk_tree_view_column_new ();
renderer = gtk_cell_renderer_pixbuf_new ();
@@ -1344,8 +1595,10 @@
g_return_if_fail (PK_IS_APPLICATION (application));
/* hide the details */
- widget = glade_xml_get_widget (application->priv->glade_xml, "notebook_description");
+ widget = glade_xml_get_widget (application->priv->glade_xml, "vbox_detail_extra");
gtk_widget_hide (widget);
+ widget = glade_xml_get_widget (application->priv->glade_xml, "button_homepage");
+ gtk_widget_set_sensitive (widget, FALSE);
/* clear the search text if we clicked the group list */
widget = glade_xml_get_widget (application->priv->glade_xml, "entry_text");
@@ -1370,215 +1623,92 @@
}
/**
- * gpk_application_notebook_populate:
+ * gpk_application_packages_treeview_clicked_cb:
**/
-static gboolean
-gpk_application_notebook_populate (GpkApplication *application, gint page)
+static void
+gpk_application_packages_treeview_clicked_cb (GtkTreeSelection *selection, GpkApplication *application)
{
- gboolean ret;
GtkWidget *widget;
- GtkWidget *child;
- gint potential;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ gboolean ret;
GError *error = NULL;
+ gboolean show_install = TRUE;
+ gboolean show_remove = TRUE;
+ GpkPackageState state;
- g_return_val_if_fail (PK_IS_APPLICATION (application), FALSE);
-
- /* are we just removing tabs? */
- if (application->priv->package == NULL) {
- return FALSE;
- }
-
- /* show the box */
- widget = glade_xml_get_widget (application->priv->glade_xml, "notebook_description");
- gtk_widget_show (widget);
+ g_return_if_fail (PK_IS_APPLICATION (application));
- /* get the notebook reference */
- widget = glade_xml_get_widget (application->priv->glade_xml, "notebook_description");
+ /* reset */
+ g_free (application->priv->package);
+ application->priv->package = NULL;
- /* are we description? */
- child = glade_xml_get_widget (application->priv->glade_xml, "vbox_description");
- potential = gtk_notebook_page_num (GTK_NOTEBOOK (widget), child);
- pk_debug ("potential=%i", potential);
- if (potential == page) {
- /* clear the old text */
- widget = glade_xml_get_widget (application->priv->glade_xml, "textview_description");
- gpk_application_set_text_buffer (widget, NULL);
-
- /* cancel any previous request */
- ret = pk_client_reset (application->priv->client_details, &error);
- if (!ret) {
- pk_warning ("failed to cancel, and adding to queue: %s", error->message);
- g_error_free (error);
- return FALSE;
- }
+ /* This will only work in single or browse selection mode! */
+ if (!gtk_tree_selection_get_selected (selection, &model, &iter)) {
+ pk_debug ("no row selected");
- /* get the details */
- ret = pk_client_get_details (application->priv->client_details,
- application->priv->package, &error);
- if (!ret) {
- pk_warning ("failed to get details: %s", error->message);
- g_error_free (error);
- }
- return ret;
+ /* we cannot now add it */
+ gpk_application_allow_install (application, FALSE);
+ gpk_application_allow_remove (application, FALSE);
+ widget = glade_xml_get_widget (application->priv->glade_xml, "menuitem_selection");
+ gtk_widget_hide (widget);
+ widget = glade_xml_get_widget (application->priv->glade_xml, "vbox_detail_extra");
+ gtk_widget_hide (widget);
+ return;
}
- /* are we description? */
- child = glade_xml_get_widget (application->priv->glade_xml, "vbox_files");
- potential = gtk_notebook_page_num (GTK_NOTEBOOK (widget), child);
- pk_debug ("potential=%i", potential);
- if (potential == page) {
- /* clear the old text */
- widget = glade_xml_get_widget (application->priv->glade_xml, "textview_files");
- gpk_application_set_text_buffer (widget, NULL);
-
- /* cancel any previous request */
- ret = pk_client_reset (application->priv->client_files, &error);
- if (!ret) {
- pk_warning ("failed to cancel, and adding to queue: %s", error->message);
- g_error_free (error);
- return FALSE;
- }
+ /* show the menu item */
+ widget = glade_xml_get_widget (application->priv->glade_xml, "menuitem_selection");
+ gtk_widget_show (widget);
- /* get the filelist */
- ret = pk_client_get_files (application->priv->client_files,
- application->priv->package, &error);
- if (!ret) {
- pk_warning ("failed to det depends: %s", error->message);
- g_error_free (error);
- }
- return ret;
- }
+ /* get data */
+ gtk_tree_model_get (model, &iter,
+ PACKAGES_COLUMN_STATE, &state,
+ PACKAGES_COLUMN_ID, &application->priv->package, -1);
- /* are we depends? */
- child = glade_xml_get_widget (application->priv->glade_xml, "vbox_depends");
- potential = gtk_notebook_page_num (GTK_NOTEBOOK (widget), child);
- pk_debug ("potential=%i", potential);
- if (potential == page) {
- /* clear the old text */
- widget = glade_xml_get_widget (application->priv->glade_xml, "textview_depends");
- gpk_application_set_text_buffer (widget, NULL);
-
- /* cancel any previous request */
- ret = pk_client_reset (application->priv->client_files, &error);
- if (!ret) {
- pk_warning ("failed to cancel, and adding to queue: %s", error->message);
- g_error_free (error);
- return FALSE;
- }
- /* get the depends */
- ret = pk_client_get_depends (application->priv->client_files, PK_FILTER_ENUM_NONE,
- application->priv->package, FALSE, &error);
-
- if (!ret) {
- pk_warning ("failed to det depends: %s", error->message);
- g_error_free (error);
- }
- return ret;
- }
+ show_install = (state == GPK_STATE_AVAILABLE || state == GPK_STATE_INSTALLED_TO_BE_REMOVED);
+ show_remove = (state == GPK_STATE_INSTALLED || state == GPK_STATE_AVAILABLE_TO_BE_INSTALLED);
- /* are we requires? */
- child = glade_xml_get_widget (application->priv->glade_xml, "vbox_requires");
- potential = gtk_notebook_page_num (GTK_NOTEBOOK (widget), child);
- pk_debug ("potential=%i", potential);
- if (potential == page) {
- /* clear the old text */
- widget = glade_xml_get_widget (application->priv->glade_xml, "textview_requires");
- gpk_application_set_text_buffer (widget, NULL);
-
- /* cancel any previous request */
- ret = pk_client_reset (application->priv->client_files, &error);
- if (!ret) {
- pk_warning ("failed to cancel, and adding to queue: %s", error->message);
- g_error_free (error);
- return FALSE;
- }
- /* get the requires */
- ret = pk_client_get_requires (application->priv->client_files, PK_FILTER_ENUM_NONE,
- application->priv->package, TRUE, &error);
-
- if (!ret) {
- pk_warning ("failed to det depends: %s", error->message);
- g_error_free (error);
- }
- return ret;
+ if (application->priv->action == PK_ACTION_INSTALL && !gpk_application_state_in_queue (state)) {
+ show_remove = FALSE;
+ }
+ if (application->priv->action == PK_ACTION_REMOVE && !gpk_application_state_in_queue (state)) {
+ show_install = FALSE;
}
- pk_warning ("unknown tab %i!", page);
- return FALSE;
-}
-
-/**
- * gpk_application_notebook_changed_cb:
- **/
-static void
-gpk_application_notebook_changed_cb (GtkWidget *widget, gboolean arg1,
- gint page, GpkApplication *application)
-{
- g_return_if_fail (PK_IS_APPLICATION (application));
-
- gpk_application_notebook_populate (application, page);
-}
-
-/**
- * gpk_application_packages_treeview_clicked_cb:
- **/
-static void
-gpk_application_packages_treeview_clicked_cb (GtkTreeSelection *selection, GpkApplication *application)
-{
- GtkWidget *widget;
- GtkTreeModel *model;
- GtkTreeIter iter;
- gboolean installed;
- gchar *package_id;
- guint page;
-
- g_return_if_fail (PK_IS_APPLICATION (application));
-
- /* This will only work in single or browse selection mode! */
- if (gtk_tree_selection_get_selected (selection, &model, &iter)) {
- g_free (application->priv->package);
- gtk_tree_model_get (model, &iter,
- PACKAGES_COLUMN_INSTALLED, &installed,
- PACKAGES_COLUMN_ID, &package_id, -1);
-
- /* we can now add it */
- widget = glade_xml_get_widget (application->priv->glade_xml, "toolbutton_list_add");
- gtk_widget_set_sensitive (widget, TRUE);
- /* make back into package ID */
- application->priv->package = g_strdup (package_id);
- g_free (package_id);
- pk_debug ("selected row is: %i %s", installed, application->priv->package);
-
- /* only show add if we are in the correct mode */
- widget = glade_xml_get_widget (application->priv->glade_xml, "toolbutton_list_add");
- if (application->priv->action == PK_ACTION_INSTALL && installed) {
- gtk_widget_set_sensitive (widget, FALSE);
- } else if (application->priv->action == PK_ACTION_REMOVE && !installed) {
- gtk_widget_set_sensitive (widget, FALSE);
- } else {
- gtk_widget_set_sensitive (widget, TRUE);
- }
+ /* only show buttons if we are in the correct mode */
+ gpk_application_allow_install (application, show_install);
+ gpk_application_allow_remove (application, show_remove);
- /* refresh */
- widget = glade_xml_get_widget (application->priv->glade_xml, "notebook_description");
- page = gtk_notebook_get_current_page (GTK_NOTEBOOK (widget));
- gpk_application_notebook_populate (application, page);
+ /* clear the old text */
+ widget = glade_xml_get_widget (application->priv->glade_xml, "textview_description");
+ gpk_application_set_text_buffer (widget, NULL);
- } else {
- pk_debug ("no row selected");
+ /* hide stuff until we have data */
+ widget = glade_xml_get_widget (application->priv->glade_xml, "vbox_detail_extra");
+ gtk_widget_hide (widget);
+ widget = glade_xml_get_widget (application->priv->glade_xml, "button_homepage");
+ gtk_widget_set_sensitive (widget, FALSE);
- /* we cannot now add it */
- widget = glade_xml_get_widget (application->priv->glade_xml, "toolbutton_list_add");
- gtk_widget_set_sensitive (widget, FALSE);
+ /* only show run menuitem for installed programs */
+ ret = gpk_application_state_installed (state);
+ widget = glade_xml_get_widget (application->priv->glade_xml, "menuitem_run");
+ gtk_widget_set_sensitive (widget, ret);
- /* make back into package ID */
- g_free (application->priv->package);
- application->priv->package = NULL;
+ /* cancel any previous request */
+ ret = pk_client_reset (application->priv->client_details, &error);
+ if (!ret) {
+ pk_warning ("failed to cancel, and adding to queue: %s", error->message);
+ g_error_free (error);
+ return;
+ }
- widget = glade_xml_get_widget (application->priv->glade_xml, "button_homepage");
- gtk_widget_hide (widget);
- widget = glade_xml_get_widget (application->priv->glade_xml, "hbox_filesize");
- gtk_widget_hide (widget);
+ /* get the details */
+ ret = pk_client_get_details (application->priv->client_details,
+ application->priv->package, &error);
+ if (!ret) {
+ pk_warning ("failed to get details: %s", error->message);
+ g_error_free (error);
}
}
@@ -1798,7 +1928,6 @@
return GTK_TREE_MODEL (store);
}
-
/**
* * gpk_application_about_dialog_url_cb:
* **/
@@ -1930,10 +2059,10 @@
}
/**
- * gpk_application_button_sources_cb:
+ * gpk_application_menu_sources_cb:
**/
static void
-gpk_application_button_sources_cb (GtkWidget *widget, GpkApplication *application)
+gpk_application_menu_sources_cb (GtkAction *action, GpkApplication *application)
{
gboolean ret;
@@ -1946,10 +2075,10 @@
}
/**
- * gpk_application_button_refresh_cb:
+ * gpk_application_menu_refresh_cb:
**/
static void
-gpk_application_button_refresh_cb (GtkWidget *widget, GpkApplication *application)
+gpk_application_menu_refresh_cb (GtkAction *action, GpkApplication *application)
{
gpk_client_refresh_cache (application->priv->gclient, NULL);
}
@@ -2266,10 +2395,8 @@
{
GtkTreeModel *model;
GtkTreeIter iter;
- gchar *package_id = NULL;
- gchar **package_ids = NULL;
- gboolean installed;
gboolean ret;
+ GpkPackageState state;
g_return_if_fail (PK_IS_APPLICATION (application));
@@ -2281,23 +2408,15 @@
return;
}
- /* get details */
+ g_free (application->priv->package);
gtk_tree_model_get (model, &iter,
- PACKAGES_COLUMN_INSTALLED, &installed,
- PACKAGES_COLUMN_ID, &package_id, -1);
- if (!installed) {
- pk_debug ("auto installing due to double click");
-
- package_ids = g_strsplit (package_id, "|", 1);
- ret = gpk_client_install_package_ids (application->priv->gclient, package_ids, NULL);
- g_strfreev (package_ids);
-
- /* refresh the search as the items may have changed and the filter has not changed */
- if (ret) {
- gpk_application_refresh_search_results (application);
- }
+ PACKAGES_COLUMN_STATE, &state,
+ PACKAGES_COLUMN_ID, &application->priv->package, -1);
+ if (gpk_application_state_get_checkbox (state)) {
+ gpk_application_button_remove_cb (NULL, application);
+ } else {
+ gpk_application_button_install_cb (NULL, application);
}
- g_free (package_id);
}
/**
@@ -2339,7 +2458,6 @@
gpk_application_init (GpkApplication *application)
{
GtkWidget *main_window;
- GtkWidget *vbox;
GtkWidget *widget;
GtkEntryCompletion *completion;
GtkTreeModel *completion_model;
@@ -2347,7 +2465,6 @@
gboolean autocomplete;
gboolean enabled;
gchar *locale; /* does not need to be freed */
- guint page;
guint i;
gboolean ret;
GError *error = NULL;
@@ -2414,8 +2531,6 @@
application->priv->client_files = pk_client_new ();
pk_client_set_use_buffer (application->priv->client_files, TRUE, NULL);
- g_signal_connect (application->priv->client_files, "files",
- G_CALLBACK (gpk_application_files_cb), application);
g_signal_connect (application->priv->client_files, "error-code",
G_CALLBACK (gpk_application_error_code_cb), application);
g_signal_connect (application->priv->client_files, "finished",
@@ -2462,36 +2577,37 @@
g_signal_connect (main_window, "delete_event",
G_CALLBACK (gpk_application_delete_event_cb), application);
- /* connect normal buttons */
- widget = glade_xml_get_widget (application->priv->glade_xml, "button_homepage");
+ /* install */
+ widget = glade_xml_get_widget (application->priv->glade_xml, "button_install");
g_signal_connect (widget, "clicked",
- G_CALLBACK (gpk_application_homepage_cb), application);
- gtk_widget_set_tooltip_text (widget, _("Visit homepage for selected package"));
+ G_CALLBACK (gpk_application_button_install_cb), application);
+ gtk_widget_set_tooltip_text (widget, _("Add current selection"));
+ gtk_widget_set_sensitive (widget, FALSE);
- /* add */
- widget = glade_xml_get_widget (application->priv->glade_xml, "toolbutton_list_add");
+ /* remove */
+ widget = glade_xml_get_widget (application->priv->glade_xml, "button_remove");
g_signal_connect (widget, "clicked",
- G_CALLBACK (gpk_application_button_list_add_cb), application);
- gtk_widget_set_tooltip_text (widget, _("Add current selection"));
+ G_CALLBACK (gpk_application_button_remove_cb), application);
+ gtk_widget_set_tooltip_text (widget, _("Remove current selection"));
gtk_widget_set_sensitive (widget, FALSE);
/* clear */
- widget = glade_xml_get_widget (application->priv->glade_xml, "toolbutton_list_clear");
+ widget = glade_xml_get_widget (application->priv->glade_xml, "button_clear");
g_signal_connect (widget, "clicked",
- G_CALLBACK (gpk_application_button_list_clear_cb), application);
+ G_CALLBACK (gpk_application_button_clear_cb), application);
gtk_widget_set_tooltip_text (widget, _("Clear current selection"));
- /* install */
- widget = glade_xml_get_widget (application->priv->glade_xml, "toolbutton_install");
+ /* homepage */
+ widget = glade_xml_get_widget (application->priv->glade_xml, "button_homepage");
g_signal_connect (widget, "clicked",
- G_CALLBACK (gpk_application_button_install_remove_cb), application);
- gtk_widget_set_tooltip_text (widget, _("Install current selection"));
+ G_CALLBACK (gpk_application_button_homepage_cb), application);
+ gtk_widget_set_tooltip_text (widget, _("Visit project homepage"));
+ gtk_widget_set_sensitive (widget, FALSE);
- /* remove */
- widget = glade_xml_get_widget (application->priv->glade_xml, "toolbutton_remove");
+ /* install */
+ widget = glade_xml_get_widget (application->priv->glade_xml, "button_apply");
g_signal_connect (widget, "clicked",
- G_CALLBACK (gpk_application_button_install_remove_cb), application);
- gtk_widget_set_tooltip_text (widget, _("Remove current selection"));
+ G_CALLBACK (gpk_application_button_apply_cb), application);
widget = glade_xml_get_widget (application->priv->glade_xml, "menuitem_about");
g_signal_connect (widget, "activate",
@@ -2501,14 +2617,49 @@
g_signal_connect (widget, "activate",
G_CALLBACK (gpk_application_menu_help_cb), application);
- /* connect up the other menuitems */
- widget = glade_xml_get_widget (application->priv->glade_xml, "toolbutton_sources");
- g_signal_connect (widget, "clicked",
- G_CALLBACK (gpk_application_button_sources_cb), application);
+ widget = glade_xml_get_widget (application->priv->glade_xml, "menuitem_sources");
+ g_signal_connect (widget, "activate",
+ G_CALLBACK (gpk_application_menu_sources_cb), application);
- widget = glade_xml_get_widget (application->priv->glade_xml, "toolbutton_refresh");
- g_signal_connect (widget, "clicked",
- G_CALLBACK (gpk_application_button_refresh_cb), application);
+ widget = glade_xml_get_widget (application->priv->glade_xml, "menuitem_refresh");
+ g_signal_connect (widget, "activate",
+ G_CALLBACK (gpk_application_menu_refresh_cb), application);
+
+ widget = glade_xml_get_widget (application->priv->glade_xml, "menuitem_homepage");
+ g_signal_connect (widget, "activate",
+ G_CALLBACK (gpk_application_menu_homepage_cb), application);
+ gtk_widget_set_tooltip_text (widget, _("Visit homepage for selected package"));
+
+ widget = glade_xml_get_widget (application->priv->glade_xml, "menuitem_files");
+ g_signal_connect (widget, "activate",
+ G_CALLBACK (gpk_application_menu_files_cb), application);
+
+ widget = glade_xml_get_widget (application->priv->glade_xml, "menuitem_install");
+ g_signal_connect (widget, "activate",
+ G_CALLBACK (gpk_application_menu_install_cb), application);
+
+ widget = glade_xml_get_widget (application->priv->glade_xml, "menuitem_remove");
+ g_signal_connect (widget, "activate",
+ G_CALLBACK (gpk_application_menu_remove_cb), application);
+
+ widget = glade_xml_get_widget (application->priv->glade_xml, "menuitem_depends");
+ g_signal_connect (widget, "activate",
+ G_CALLBACK (gpk_application_menu_depends_cb), application);
+
+ widget = glade_xml_get_widget (application->priv->glade_xml, "menuitem_requires");
+ g_signal_connect (widget, "activate",
+ G_CALLBACK (gpk_application_menu_requires_cb), application);
+
+ widget = glade_xml_get_widget (application->priv->glade_xml, "menuitem_run");
+ g_signal_connect (widget, "activate",
+ G_CALLBACK (gpk_application_menu_run_cb), application);
+
+ widget = glade_xml_get_widget (application->priv->glade_xml, "menuitem_selection");
+ gtk_widget_hide (widget);
+ widget = glade_xml_get_widget (application->priv->glade_xml, "image_icon");
+ gtk_widget_hide (widget);
+ widget = glade_xml_get_widget (application->priv->glade_xml, "vbox_detail_extra");
+ gtk_widget_hide (widget);
/* installed filter */
widget = glade_xml_get_widget (application->priv->glade_xml, "menuitem_installed_yes");
@@ -2576,15 +2727,6 @@
g_signal_connect (widget, "toggled",
G_CALLBACK (gpk_application_menu_filter_source_cb), application);
- widget = glade_xml_get_widget (application->priv->glade_xml, "notebook_description");
- gtk_widget_hide (widget);
-
- widget = glade_xml_get_widget (application->priv->glade_xml, "hbox_filesize");
- gtk_widget_hide (widget);
-
- widget = glade_xml_get_widget (application->priv->glade_xml, "hbox_source");
- gtk_widget_hide (widget);
-
/* basename filter */
widget = glade_xml_get_widget (application->priv->glade_xml, "menuitem_basename");
g_signal_connect (widget, "toggled",
@@ -2595,33 +2737,22 @@
g_signal_connect (widget, "toggled",
G_CALLBACK (gpk_application_menu_filter_newest_cb), application);
- /* set current action */
- application->priv->action = PK_ACTION_NONE;
- gpk_application_set_button_actions (application);
-
/* Remove description/file list if needed. */
- widget = glade_xml_get_widget (application->priv->glade_xml, "notebook_description");
- g_signal_connect (widget, "switch-page",
- G_CALLBACK (gpk_application_notebook_changed_cb), application);
if (pk_enums_contain (application->priv->roles, PK_ROLE_ENUM_GET_DETAILS) == FALSE) {
- vbox = glade_xml_get_widget (application->priv->glade_xml, "vbox_description");
- page = gtk_notebook_page_num (GTK_NOTEBOOK (widget), vbox);
- gtk_notebook_remove_page (GTK_NOTEBOOK (widget), page);
+ widget = glade_xml_get_widget (application->priv->glade_xml, "scrolledwindow2");
+ gtk_widget_hide (widget);
}
if (pk_enums_contain (application->priv->roles, PK_ROLE_ENUM_GET_FILES) == FALSE) {
- vbox = glade_xml_get_widget (application->priv->glade_xml, "vbox_files");
- page = gtk_notebook_page_num (GTK_NOTEBOOK (widget), vbox);
- gtk_notebook_remove_page (GTK_NOTEBOOK (widget), page);
+ widget = glade_xml_get_widget (application->priv->glade_xml, "menuitem_files");
+ gtk_widget_hide (widget);
}
if (pk_enums_contain (application->priv->roles, PK_ROLE_ENUM_GET_DEPENDS) == FALSE) {
- vbox = glade_xml_get_widget (application->priv->glade_xml, "vbox_depends");
- page = gtk_notebook_page_num (GTK_NOTEBOOK (widget), vbox);
- gtk_notebook_remove_page (GTK_NOTEBOOK (widget), page);
+ widget = glade_xml_get_widget (application->priv->glade_xml, "menuitem_depends");
+ gtk_widget_hide (widget);
}
if (pk_enums_contain (application->priv->roles, PK_ROLE_ENUM_GET_REQUIRES) == FALSE) {
- vbox = glade_xml_get_widget (application->priv->glade_xml, "vbox_requires");
- page = gtk_notebook_page_num (GTK_NOTEBOOK (widget), vbox);
- gtk_notebook_remove_page (GTK_NOTEBOOK (widget), page);
+ widget = glade_xml_get_widget (application->priv->glade_xml, "menuitem_requires");
+ gtk_widget_hide (widget);
}
/* hide the group selector if we don't support search-groups */
@@ -2632,13 +2763,13 @@
/* hide the refresh cache button if we can't do it */
if (pk_enums_contain (application->priv->roles, PK_ROLE_ENUM_REFRESH_CACHE) == FALSE) {
- widget = glade_xml_get_widget (application->priv->glade_xml, "toolbutton_refresh");
+ widget = glade_xml_get_widget (application->priv->glade_xml, "menuitem_refresh");
gtk_widget_hide (widget);
}
/* hide the software-sources button if we can't do it */
if (pk_enums_contain (application->priv->roles, PK_ROLE_ENUM_GET_REPO_LIST) == FALSE) {
- widget = glade_xml_get_widget (application->priv->glade_xml, "toolbutton_sources");
+ widget = glade_xml_get_widget (application->priv->glade_xml, "menuitem_sources");
gtk_widget_hide (widget);
}
@@ -2760,7 +2891,7 @@
/* create list stores */
application->priv->packages_store = gtk_list_store_new (PACKAGES_COLUMN_LAST,
G_TYPE_STRING,
- G_TYPE_BOOLEAN,
+ G_TYPE_UINT,
G_TYPE_BOOLEAN,
G_TYPE_BOOLEAN,
G_TYPE_STRING,
@@ -2832,6 +2963,10 @@
pk_warning ("failed to get repo list: %s", error->message);
g_error_free (error);
}
+
+ /* set current action */
+ application->priv->action = PK_ACTION_NONE;
+ gpk_application_set_buttons_apply_clear (application);
}
/**
Modified: trunk/src/gpk-client-chooser.c
==============================================================================
--- trunk/src/gpk-client-chooser.c (original)
+++ trunk/src/gpk-client-chooser.c Tue Jun 10 15:23:42 2008
@@ -32,6 +32,7 @@
#include <pk-common.h>
#include <pk-client.h>
#include <pk-enum.h>
+#include <pk-extra.h>
#include <pk-package-id.h>
#include "gpk-gnome.h"
#include "gpk-common.h"
@@ -172,7 +173,10 @@
GtkWidget *widget;
GtkTreeSelection *selection;
PkPackageItem *item;
+ PkPackageId *ident;
GtkTreeIter iter;
+ PkExtra *extra;
+ gboolean ret;
const gchar *icon_name;
gchar *text;
guint len;
@@ -213,6 +217,13 @@
/* connect up PolicyKit actions */
g_signal_connect (button_action, "activate", G_CALLBACK (gpk_client_chooser_button_action_cb), NULL);
+ /* no point showing install button */
+ if (role == PK_ROLE_ENUM_GET_DEPENDS ||
+ role == PK_ROLE_ENUM_GET_REQUIRES) {
+ widget = glade_xml_get_widget (glade_xml, "button_action");
+ gtk_widget_hide (widget);
+ }
+
/* create list stores */
list_store = gtk_list_store_new (GPK_CHOOSER_COLUMN_LAST, G_TYPE_STRING,
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
@@ -230,6 +241,9 @@
pk_treeview_add_general_columns (GTK_TREE_VIEW (widget));
gtk_tree_view_columns_autosize (GTK_TREE_VIEW (widget));
+ /* use PkExtra to get better icon */
+ extra = pk_extra_new ();
+
/* see what we've got already */
len = pk_package_list_get_size (list);
for (i=0; i<len; i++) {
@@ -239,7 +253,18 @@
/* put formatted text into treeview */
gtk_list_store_append (list_store, &iter);
text = gpk_package_id_format_twoline (item->package_id, item->summary);
- icon_name = gpk_info_enum_to_icon_name (PK_INFO_ENUM_AVAILABLE);
+
+ /* get the icon */
+ ident = pk_package_id_new_from_string (item->package_id);
+ icon_name = pk_extra_get_icon_name (extra, ident->name);
+ pk_package_id_free (ident);
+
+ /* check icon actually exists and is valid in this theme */
+ ret = gpk_check_icon_valid (icon_name);
+ if (!ret) {
+ icon_name = gpk_info_enum_to_icon_name (item->info);
+ }
+
gtk_list_store_set (list_store, &iter,
GPK_CHOOSER_COLUMN_TEXT, text,
GPK_CHOOSER_COLUMN_ID, item->package_id, -1);
@@ -247,6 +272,8 @@
g_free (text);
}
+ g_object_unref (extra);
+
/* show window */
widget = glade_xml_get_widget (glade_xml, "window_simple");
gtk_widget_show (widget);
Modified: trunk/src/gpk-client.c
==============================================================================
--- trunk/src/gpk-client.c (original)
+++ trunk/src/gpk-client.c Tue Jun 10 15:23:42 2008
@@ -42,6 +42,7 @@
#include <pk-package-id.h>
#include <pk-common.h>
#include <pk-control.h>
+#include <pk-catalog.h>
#include <gpk-client.h>
#include <gpk-client-eula.h>
@@ -88,6 +89,7 @@
gboolean gtk_main_waiting;
gchar **files_array;
PkExitEnum exit;
+ GtkWindow *parent_window;
};
typedef enum {
@@ -172,6 +174,37 @@
}
/**
+ * gpk_client_main_wait:
+ **/
+static gboolean
+gpk_client_main_wait (GpkClient *gclient)
+{
+ if (gclient->priv->gtk_main_waiting) {
+ pk_warning ("already started!");
+ return FALSE;
+ }
+ /* wait for completion */
+ gclient->priv->gtk_main_waiting = TRUE;
+ gtk_main ();
+ gclient->priv->gtk_main_waiting = FALSE;
+ return TRUE;
+}
+
+/**
+ * gpk_client_main_quit:
+ **/
+static gboolean
+gpk_client_main_quit (GpkClient *gclient)
+{
+ if (!gclient->priv->gtk_main_waiting) {
+ pk_warning ("not already started!");
+ return FALSE;
+ }
+ gtk_main_quit ();
+ return TRUE;
+}
+
+/**
* gpk_client_updates_button_close_cb:
**/
static void
@@ -208,7 +241,9 @@
/* go! */
gtk_widget_hide (widget);
- gtk_main_quit ();
+
+ pk_debug ("quitting due to window close");
+ gpk_client_main_quit (gclient);
g_signal_emit (gclient, signals [GPK_CLIENT_QUIT], 0);
return FALSE;
}
@@ -229,7 +264,8 @@
/* the timer will be done */
gclient->priv->finished_timer_id = 0;
- gtk_main_quit ();
+ pk_debug ("quitting due to timeout");
+ gpk_client_main_quit (gclient);
g_signal_emit (gclient, signals [GPK_CLIENT_QUIT], 0);
return FALSE;
}
@@ -442,8 +478,37 @@
out:
/* only quit if there is not another transaction scheduled to be finished */
if (!gclient->priv->using_secondary_client) {
- pk_debug ("quitting");
- gtk_main_quit ();
+ pk_debug ("quitting due to finished");
+ gpk_client_main_quit (gclient);
+ }
+}
+
+/**
+ * gpk_client_pulse_progress:
+ **/
+static gboolean
+gpk_client_pulse_progress (GpkClient *gclient)
+{
+ GtkWidget *widget;
+
+ g_return_val_if_fail (GPK_IS_CLIENT (gclient), FALSE);
+
+ widget = glade_xml_get_widget (gclient->priv->glade_xml, "progressbar_percent");
+ gtk_progress_bar_pulse (GTK_PROGRESS_BAR (widget));
+ return TRUE;
+}
+
+/**
+ * gpk_client_make_progressbar_pulse:
+ **/
+static void
+gpk_client_make_progressbar_pulse (GpkClient *gclient)
+{
+ GtkWidget *widget;
+ if (gclient->priv->pulse_timer_id == 0) {
+ widget = glade_xml_get_widget (gclient->priv->glade_xml, "progressbar_percent");
+ gtk_progress_bar_set_pulse_step (GTK_PROGRESS_BAR (widget ), 0.04);
+ gclient->priv->pulse_timer_id = g_timeout_add (75, (GSourceFunc) gpk_client_pulse_progress, gclient);
}
}
@@ -464,27 +529,15 @@
gclient->priv->pulse_timer_id = 0;
}
- if (percentage != PK_CLIENT_PERCENTAGE_INVALID) {
+ /* either pulse or set percentage */
+ if (percentage == PK_CLIENT_PERCENTAGE_INVALID) {
+ gpk_client_make_progressbar_pulse (gclient);
+ } else {
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (widget), (gfloat) percentage / 100.0);
}
}
/**
- * gpk_client_pulse_progress:
- **/
-static gboolean
-gpk_client_pulse_progress (GpkClient *gclient)
-{
- GtkWidget *widget;
-
- g_return_val_if_fail (GPK_IS_CLIENT (gclient), FALSE);
-
- widget = glade_xml_get_widget (gclient->priv->glade_xml, "progressbar_percent");
- gtk_progress_bar_pulse (GTK_PROGRESS_BAR (widget));
- return TRUE;
-}
-
-/**
* gpk_client_status_changed_cb:
**/
static void
@@ -495,6 +548,18 @@
g_return_if_fail (GPK_IS_CLIENT (gclient));
+ /* do we force progress? */
+ if (status == PK_STATUS_ENUM_DOWNLOAD_REPOSITORY ||
+ status == PK_STATUS_ENUM_DOWNLOAD_PACKAGELIST ||
+ status == PK_STATUS_ENUM_DOWNLOAD_FILELIST ||
+ status == PK_STATUS_ENUM_DOWNLOAD_CHANGELOG ||
+ status == PK_STATUS_ENUM_DOWNLOAD_GROUP ||
+ status == PK_STATUS_ENUM_DOWNLOAD_UPDATEINFO ||
+ status == PK_STATUS_ENUM_REFRESH_CACHE) {
+ gpk_client_show_progress (gclient, TRUE);
+ gpk_client_set_page (gclient, GPK_CLIENT_PAGE_PROGRESS);
+ }
+
/* set icon */
widget = glade_xml_get_widget (gclient->priv->glade_xml, "image_status");
gpk_set_animated_icon_from_status (GPK_ANIMATED_ICON (widget), status, GTK_ICON_SIZE_DIALOG);
@@ -507,12 +572,7 @@
g_free (text);
if (status == PK_STATUS_ENUM_WAIT) {
- if (gclient->priv->pulse_timer_id == 0) {
- widget = glade_xml_get_widget (gclient->priv->glade_xml, "progressbar_percent");
-
- gtk_progress_bar_set_pulse_step (GTK_PROGRESS_BAR (widget ), 0.04);
- gclient->priv->pulse_timer_id = g_timeout_add (75, (GSourceFunc) gpk_client_pulse_progress, gclient);
- }
+ gpk_client_make_progressbar_pulse (gclient);
}
}
@@ -579,6 +639,19 @@
}
/**
+ * gpk_client_set_package_label:
+ **/
+static gboolean
+gpk_client_set_package_label (GpkClient *gclient, const gchar *text)
+{
+ GtkWidget *widget;
+ widget = glade_xml_get_widget (gclient->priv->glade_xml, "label_package");
+ gtk_widget_show (widget);
+ gtk_label_set_markup (GTK_LABEL (widget), text);
+ return TRUE;
+}
+
+/**
* gpk_client_package_cb:
**/
static void
@@ -586,8 +659,6 @@
const gchar *summary, GpkClient *gclient)
{
gchar *text;
- GtkWidget *widget;
-
g_return_if_fail (GPK_IS_CLIENT (gclient));
/* ignore this if it's uninteresting */
@@ -596,9 +667,7 @@
}
text = gpk_package_id_format_twoline (package_id, summary);
- widget = glade_xml_get_widget (gclient->priv->glade_xml, "label_package");
- gtk_widget_show (widget);
- gtk_label_set_markup (GTK_LABEL (widget), text);
+ gpk_client_set_package_label (gclient, text);
g_free (text);
}
@@ -621,7 +690,6 @@
}
/* set new */
- g_strfreev (gclient->priv->files_array);
gclient->priv->files_array = g_strsplit (filelist, ";", 0);
}
@@ -816,6 +884,9 @@
gtk_widget_set_size_request (widget, requisition.width, requisition.height);
gtk_label_set_label (GTK_LABEL (widget), "");
+ /* start with the progressbar pulsing */
+ gpk_client_make_progressbar_pulse (gclient);
+
return TRUE;
}
@@ -895,7 +966,8 @@
message = g_strjoinv ("\n", files_rel);
/* show UI */
- dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_DESTROY_WITH_PARENT,
+ dialog = gtk_message_dialog_new (gclient->priv->parent_window,
+ GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_QUESTION, GTK_BUTTONS_OK_CANCEL,
"%s", title);
gtk_message_dialog_format_secondary_markup (GTK_MESSAGE_DIALOG (dialog), "%s", message);
@@ -908,7 +980,8 @@
if (button != GTK_RESPONSE_OK) {
title = ngettext (_("The file was not installed"),
_("The files were not installed"), length);
- dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_DESTROY_WITH_PARENT,
+ dialog = gtk_message_dialog_new (gclient->priv->parent_window,
+ GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_INFO, GTK_BUTTONS_OK,
"%s", title);
gtk_dialog_run (GTK_DIALOG (dialog));
@@ -930,10 +1003,7 @@
gpk_client_set_progress_files (gclient, TRUE);
gpk_client_set_page (gclient, GPK_CLIENT_PAGE_PROGRESS);
- /* wait for completion */
- gclient->priv->gtk_main_waiting = TRUE;
- gtk_main ();
- gclient->priv->gtk_main_waiting = FALSE;
+ gpk_client_main_wait (gclient);
/* do we need to try again with better auth? */
if (gclient->priv->retry_untrusted_value) {
@@ -1032,10 +1102,7 @@
gpk_client_set_progress_files (gclient, TRUE);
gpk_client_set_page (gclient, GPK_CLIENT_PAGE_PROGRESS);
- /* wait for completion */
- gclient->priv->gtk_main_waiting = TRUE;
- gtk_main ();
- gclient->priv->gtk_main_waiting = FALSE;
+ gpk_client_main_wait (gclient);
/* fail the transaction and set the correct error */
ret = gpk_client_set_error_from_exit_enum (gclient->priv->exit, error);
@@ -1122,10 +1189,7 @@
goto out;
}
- /* wait for completion */
- gclient->priv->gtk_main_waiting = TRUE;
- gtk_main ();
- gclient->priv->gtk_main_waiting = FALSE;
+ gpk_client_main_wait (gclient);
/* fail the transaction and set the correct error */
ret = gpk_client_set_error_from_exit_enum (gclient->priv->exit, error);
@@ -1344,6 +1408,172 @@
}
/**
+ * gpk_client_catalog_progress_cb:
+ **/
+static void
+gpk_client_catalog_progress_cb (PkCatalog *catalog, PkCatalogProgress mode, const gchar *text, GpkClient *gclient)
+{
+ gchar *message = NULL;
+
+ g_return_if_fail (GPK_IS_CLIENT (gclient));
+
+ if (mode == PK_CATALOG_PROGRESS_PACKAGES) {
+ message = g_strdup_printf (_("Finding package name: %s"), text);
+ } else if (mode == PK_CATALOG_PROGRESS_FILES) {
+ message = g_strdup_printf (_("Finding file name: %s"), text);
+ } else if (mode == PK_CATALOG_PROGRESS_PROVIDES) {
+ message = g_strdup_printf (_("Finding a package to provide: %s"), text);
+ }
+
+ gpk_client_status_changed_cb (NULL, PK_STATUS_ENUM_QUERY, gclient);
+ gpk_client_set_package_label (gclient, message);
+ g_free (message);
+}
+
+/**
+ * gpk_client_install_catalogs:
+ **/
+gboolean
+gpk_client_install_catalogs (GpkClient *gclient, gchar **filenames, GError **error)
+{
+ GtkWidget *dialog;
+ GtkWidget *widget;
+ GtkResponseType button;
+ gchar **package_ids = NULL;
+ gchar *message;
+ const gchar *title;
+ gboolean ret;
+ PkPackageItem *item;
+ PkPackageList *list;
+ GPtrArray *array;
+ PkCatalog *catalog;
+ GString *string;
+ gchar *text;
+ guint len;
+ guint i;
+
+ /* check if we are already waiting */
+ if (gclient->priv->gtk_main_waiting) {
+ gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, "Already waiting on this GpkClient");
+ return FALSE;
+ }
+
+ len = g_strv_length (filenames);
+
+ title = ngettext (_("Do you want to install this catalog?"),
+ _("Do you want to install these catalogs?"), len);
+ message = g_strjoinv ("\n", filenames);
+
+ /* show UI */
+ dialog = gtk_message_dialog_new (gclient->priv->parent_window, GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_QUESTION, GTK_BUTTONS_OK_CANCEL, "%s", title);
+ gtk_message_dialog_format_secondary_markup (GTK_MESSAGE_DIALOG (dialog), "%s", message);
+
+ button = gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (GTK_WIDGET (dialog));
+ g_free (message);
+
+ /* did we click no or exit the window? */
+ if (button != GTK_RESPONSE_OK) {
+ title = ngettext (_("The catalog was not installed"),
+ _("The catalogs were not installed"), len);
+ dialog = gtk_message_dialog_new (gclient->priv->parent_window, GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_INFO, GTK_BUTTONS_OK, "%s", title);
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (GTK_WIDGET (dialog));
+ return FALSE;
+ }
+
+ /* set title */
+ gpk_client_setup_window (gclient, _("Install catalogs"));
+ gpk_client_status_changed_cb (NULL, PK_STATUS_ENUM_WAIT, gclient);
+
+ /* setup the UI */
+ gpk_client_set_progress_files (gclient, TRUE);
+ gpk_client_set_page (gclient, GPK_CLIENT_PAGE_PROGRESS);
+
+ /* get files to be installed */
+ catalog = pk_catalog_new ();
+ g_signal_connect (catalog, "progress", G_CALLBACK (gpk_client_catalog_progress_cb), gclient);
+ gclient->priv->gtk_main_waiting = TRUE;
+ list = pk_catalog_process_files (catalog, filenames);
+ gclient->priv->gtk_main_waiting = FALSE;
+ g_object_unref (catalog);
+
+ /* nothing to do? */
+ len = pk_package_list_get_size (list);
+ if (len == 0) {
+ widget = glade_xml_get_widget (gclient->priv->glade_xml, "window_updates");
+ dialog = gtk_message_dialog_new (GTK_WINDOW (widget), GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_INFO, GTK_BUTTONS_OK, _("No packages need to be installed"));
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (GTK_WIDGET (dialog));
+ ret = FALSE;
+ goto out;
+ }
+
+ /* process package list */
+ string = g_string_new (_("The following packages are marked to be installed from the catalog:"));
+ g_string_append (string, "\n\n");
+ for (i=0; i<len; i++) {
+ item = pk_package_list_get_item (list, i);
+ text = gpk_package_id_format_oneline (item->package_id, item->summary);
+ g_string_append_printf (string, "%s\n", text);
+ g_free (text);
+ }
+ /* remove last \n */
+ g_string_set_size (string, string->len - 1);
+
+ /* display messagebox */
+ text = g_string_free (string, FALSE);
+
+ /* show UI */
+ widget = glade_xml_get_widget (gclient->priv->glade_xml, "window_updates");
+ dialog = gtk_message_dialog_new (GTK_WINDOW (widget), GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_QUESTION, GTK_BUTTONS_CANCEL,
+ "%s", _("Install packages in catalog?"));
+ /* add a specialist button */
+ gtk_dialog_add_button (GTK_DIALOG (dialog), _("Install"), GTK_RESPONSE_OK);
+
+ gtk_message_dialog_format_secondary_markup (GTK_MESSAGE_DIALOG (dialog), "%s", text);
+ button = gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (GTK_WIDGET (dialog));
+ g_free (text);
+
+ /* did we click no or exit the window? */
+ if (button != GTK_RESPONSE_OK) {
+ len = g_strv_length (filenames);
+ title = ngettext (_("The catalog was not installed"),
+ _("The catalogs were not installed"), len);
+ widget = glade_xml_get_widget (gclient->priv->glade_xml, "window_updates");
+ dialog = gtk_message_dialog_new (GTK_WINDOW (widget), GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_INFO, GTK_BUTTONS_OK, "%s", title);
+ gtk_message_dialog_format_secondary_markup (GTK_MESSAGE_DIALOG (dialog), "Action was cancelled");
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (GTK_WIDGET (dialog));
+ ret = FALSE;
+ goto out;
+ }
+
+ /* convert to list of package id's */
+ array = g_ptr_array_new ();
+ for (i=0; i<len; i++) {
+ item = pk_package_list_get_item (list, i);
+ g_ptr_array_add (array, g_strdup (item->package_id));
+ }
+
+ /* install packages */
+ package_ids = pk_ptr_array_to_argv (array);
+ ret = gpk_client_install_package_ids (gclient, package_ids, error);
+
+out:
+ g_strfreev (package_ids);
+ g_object_unref (list);
+
+ return ret;
+}
+
+/**
* gpk_client_update_system:
**/
gboolean
@@ -1415,10 +1645,7 @@
}
}
- /* wait for completion */
- gclient->priv->gtk_main_waiting = TRUE;
- gtk_main ();
- gclient->priv->gtk_main_waiting = FALSE;
+ gpk_client_main_wait (gclient);
/* fail the transaction and set the correct error */
ret = gpk_client_set_error_from_exit_enum (gclient->priv->exit, error);
@@ -1483,10 +1710,7 @@
gpk_client_set_progress_files (gclient, FALSE);
gpk_client_set_page (gclient, GPK_CLIENT_PAGE_PROGRESS);
- /* wait for completion */
- gclient->priv->gtk_main_waiting = TRUE;
- gtk_main ();
- gclient->priv->gtk_main_waiting = FALSE;
+ gpk_client_main_wait (gclient);
/* fail the transaction and set the correct error */
ret = gpk_client_set_error_from_exit_enum (gclient->priv->exit, error);
@@ -1542,10 +1766,7 @@
gpk_client_set_progress_files (gclient, FALSE);
gpk_client_set_page (gclient, GPK_CLIENT_PAGE_PROGRESS);
- /* wait for completion */
- gclient->priv->gtk_main_waiting = TRUE;
- gtk_main ();
- gclient->priv->gtk_main_waiting = FALSE;
+ gpk_client_main_wait (gclient);
/* copy from client to local */
list = pk_client_get_package_list (gclient->priv->client_action);
@@ -1594,10 +1815,7 @@
gpk_client_set_progress_files (gclient, FALSE);
gpk_client_set_page (gclient, GPK_CLIENT_PAGE_PROGRESS);
- /* wait for completion */
- gclient->priv->gtk_main_waiting = TRUE;
- gtk_main ();
- gclient->priv->gtk_main_waiting = FALSE;
+ gpk_client_main_wait (gclient);
/* fail the transaction and set the correct error */
ret = gpk_client_set_error_from_exit_enum (gclient->priv->exit, error);
@@ -1608,7 +1826,7 @@
}
/* return the file list */
- return gclient->priv->files_array;
+ return g_strdupv (gclient->priv->files_array);
}
/**
@@ -1662,10 +1880,7 @@
gpk_client_set_progress_files (gclient, TRUE);
gpk_client_set_page (gclient, GPK_CLIENT_PAGE_PROGRESS);
- /* wait for completion */
- gclient->priv->gtk_main_waiting = TRUE;
- gtk_main ();
- gclient->priv->gtk_main_waiting = FALSE;
+ gpk_client_main_wait (gclient);
/* fail the transaction and set the correct error */
ret = gpk_client_set_error_from_exit_enum (gclient->priv->exit, error);
@@ -1928,10 +2143,7 @@
}
gpk_client_set_page (gclient, GPK_CLIENT_PAGE_PROGRESS);
- /* wait for completion */
- gclient->priv->gtk_main_waiting = TRUE;
- gtk_main ();
- gclient->priv->gtk_main_waiting = FALSE;
+ gpk_client_main_wait (gclient);
return TRUE;
}
@@ -1946,6 +2158,7 @@
g_return_val_if_fail (GPK_IS_CLIENT (gclient), FALSE);
widget = glade_xml_get_widget (gclient->priv->glade_xml, "window_updates");
gtk_window_set_transient_for (GTK_WINDOW (widget), window);
+ gclient->priv->parent_window = window;
return TRUE;
}
@@ -1996,6 +2209,7 @@
gclient->priv->glade_xml = NULL;
gclient->priv->files_array = NULL;
+ gclient->priv->parent_window = NULL;
gclient->priv->pulse_timer_id = 0;
gclient->priv->using_secondary_client = FALSE;
gclient->priv->gtk_main_waiting = FALSE;
@@ -2097,10 +2311,13 @@
gclient = GPK_CLIENT (object);
g_return_if_fail (gclient->priv != NULL);
- /* stop the timer if running */
+ /* stop the timers if running */
if (gclient->priv->finished_timer_id != 0) {
g_source_remove (gclient->priv->finished_timer_id);
}
+ if (gclient->priv->pulse_timer_id != 0) {
+ g_source_remove (gclient->priv->pulse_timer_id);
+ }
g_strfreev (gclient->priv->files_array);
g_object_unref (gclient->priv->client_action);
Modified: trunk/src/gpk-client.h
==============================================================================
--- trunk/src/gpk-client.h (original)
+++ trunk/src/gpk-client.h Tue Jun 10 15:23:42 2008
@@ -82,6 +82,9 @@
gboolean gpk_client_install_package_ids (GpkClient *gclient,
gchar **package_ids,
GError **error);
+gboolean gpk_client_install_catalogs (GpkClient *gclient,
+ gchar **filenames,
+ GError **error);
gboolean gpk_client_remove_package_ids (GpkClient *gclient,
gchar **package_ids,
GError **error);
Modified: trunk/src/gpk-interface.h
==============================================================================
--- trunk/src/gpk-interface.h (original)
+++ trunk/src/gpk-interface.h Tue Jun 10 15:23:42 2008
@@ -53,7 +53,7 @@
#endif /* !G_ENABLE_DEBUG */
-/* NONE:STRING,POINTER (/tmp/dbus-binding-tool-c-marshallers.1G9VBU:1) */
+/* NONE:STRING,POINTER (/tmp/dbus-binding-tool-c-marshallers.NVE1BU:1) */
extern void dbus_glib_marshal_gpk_dbus_VOID__STRING_POINTER (GClosure *closure,
GValue *return_value,
guint n_param_values,
Modified: trunk/src/gpk-update-viewer.c
==============================================================================
--- trunk/src/gpk-update-viewer.c (original)
+++ trunk/src/gpk-update-viewer.c Tue Jun 10 15:23:42 2008
@@ -1455,20 +1455,20 @@
pk_update_viewer_get_checked_status (&all_checked, &none_checked);
if (!all_checked) {
- menuitem = gtk_menu_item_new_with_label ("Select all");
+ menuitem = gtk_menu_item_new_with_label (_("Select all"));
g_signal_connect (menuitem, "activate",
G_CALLBACK (pk_update_viewer_detail_popup_menu_select_all), treeview);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
}
if (!none_checked) {
- menuitem = gtk_menu_item_new_with_label ("Unselect all");
+ menuitem = gtk_menu_item_new_with_label (_("Unselect all"));
g_signal_connect (menuitem, "activate",
G_CALLBACK (pk_update_viewer_detail_popup_menu_select_none), treeview);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
}
- menuitem = gtk_menu_item_new_with_label ("Ignore this package");
+ menuitem = gtk_menu_item_new_with_label (_("Ignore this package"));
gtk_widget_set_sensitive (GTK_WIDGET (menuitem), FALSE);
g_signal_connect (menuitem, "activate",
G_CALLBACK (pk_update_viewer_detail_popup_menu_select_all), treeview);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]