introducing settings support

This commit is contained in:
guinux 2014-01-29 15:44:19 +01:00
parent 62991a7304
commit 09ff0c9ca1
11 changed files with 903 additions and 473 deletions

11
data/etc/pamac.conf Normal file
View File

@ -0,0 +1,11 @@
### Pamac configuration file
## How often to check for updates, value in hours:
RefreshPeriod = 4
## Allow Pamac to search and install packages from AUR:
#EnableAUR
## When removing a package, also remove those dependencies
## that are not required by other packages (recurse option):
RemoveUnrequiredDeps

View File

@ -14,4 +14,12 @@
<allow_active>auth_admin_keep</allow_active> <allow_active>auth_admin_keep</allow_active>
</defaults> </defaults>
</action> </action>
<action id="org.manjaro.pamac.write_config">
<message>Authentication is required</message>
<defaults>
<allow_any>no</allow_any>
<allow_inactive>no</allow_inactive>
<allow_active>auth_admin_keep</allow_active>
</defaults>
</action>
</policyconfig> </policyconfig>

View File

@ -1,257 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.16.0 on Fri Nov 15 10:21:27 2013 --> <!-- Generated with glade 3.16.1 -->
<interface> <interface>
<!-- interface-requires gtk+ 3.6 --> <requires lib="gtk+" version="3.6"/>
<object class="GtkDialog" id="ChooseDialog">
<property name="can_focus">False</property>
<property name="title" translatable="yes">Choose</property>
<property name="modal">True</property>
<property name="window_position">center-on-parent</property>
<property name="icon_name">system-software-install</property>
<property name="type_hint">dialog</property>
<property name="deletable">False</property>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child internal-child="action_area">
<object class="GtkButtonBox" id="dialog-action_area1">
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="ChooseButton">
<property name="label">gtk-ok</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="on_ChooseButton_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="choose_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow5">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="shadow_type">in</property>
<property name="min_content_width">300</property>
<property name="min_content_height">250</property>
<child>
<object class="GtkTreeView" id="treeview5">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="model">choose_list</property>
<property name="headers_visible">False</property>
<property name="headers_clickable">False</property>
<property name="enable_search">False</property>
<property name="show_expanders">False</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection5">
<property name="mode">none</property>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="treeviewcolumn1">
<property name="sizing">autosize</property>
<child>
<object class="GtkCellRendererToggle" id="choose_renderertoggle">
<signal name="toggled" handler="on_choose_renderertoggle_toggled" swapped="no"/>
</object>
<attributes>
<attribute name="active">0</attribute>
</attributes>
</child>
<child>
<object class="GtkCellRendererText" id="choose_renderertext"/>
<attributes>
<attribute name="text">1</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
</child>
<action-widgets>
<action-widget response="0">ChooseButton</action-widget>
</action-widgets>
</object>
<object class="GtkWindow" id="ConfDialog">
<property name="can_focus">False</property>
<property name="border_width">5</property>
<property name="title" translatable="yes">Summary</property>
<property name="modal">True</property>
<property name="window_position">center-on-parent</property>
<property name="icon_name">system-software-install</property>
<property name="type_hint">dialog</property>
<property name="deletable">False</property>
<child>
<object class="GtkBox" id="box7">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">5</property>
<child>
<object class="GtkLabel" id="sum_top_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="shadow_type">in</property>
<property name="min_content_width">330</property>
<property name="min_content_height">250</property>
<child>
<object class="GtkTreeView" id="treeview4">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="model">transaction_sum</property>
<property name="headers_visible">False</property>
<property name="headers_clickable">False</property>
<property name="enable_search">False</property>
<property name="show_expanders">False</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection">
<property name="mode">none</property>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="_action">
<property name="sizing">autosize</property>
<child>
<object class="GtkCellRendererText" id="cellrenderertext5">
<property name="yalign">0</property>
<property name="weight">600</property>
</object>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="_packages">
<property name="sizing">autosize</property>
<child>
<object class="GtkCellRendererText" id="cellrenderertext6"/>
<attributes>
<attribute name="text">1</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="sum_bottom_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkButtonBox" id="buttonbox1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">7</property>
<property name="homogeneous">True</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="TransCancelButton">
<property name="label">gtk-cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="has_focus">True</property>
<property name="is_focus">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="on_TransCancelButton_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="TransValidButton">
<property name="label">gtk-ok</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="on_TransValidButton_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
</object>
</child>
</object>
<object class="GtkMessageDialog" id="ErrorDialog"> <object class="GtkMessageDialog" id="ErrorDialog">
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="resizable">False</property> <property name="resizable">False</property>
@ -319,7 +69,6 @@
<property name="icon_name">system-software-install</property> <property name="icon_name">system-software-install</property>
<property name="type_hint">dialog</property> <property name="type_hint">dialog</property>
<property name="deletable">False</property> <property name="deletable">False</property>
<property name="has_resize_grip">False</property>
<child> <child>
<object class="GtkBox" id="box8"> <object class="GtkBox" id="box8">
<property name="visible">True</property> <property name="visible">True</property>
@ -519,6 +268,176 @@
</object> </object>
</child> </child>
</object> </object>
<object class="GtkAdjustment" id="adjustment1">
<property name="upper">10000</property>
<property name="step_increment">1</property>
<property name="page_increment">10</property>
</object>
<object class="GtkWindow" id="PreferencesWindow">
<property name="can_focus">False</property>
<property name="border_width">5</property>
<property name="title" translatable="yes">Pamac Preferences</property>
<property name="window_position">center</property>
<property name="default_width">300</property>
<property name="default_height">250</property>
<child>
<object class="GtkBox" id="box1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">5</property>
<child>
<object class="GtkNotebook" id="notebook1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<child>
<object class="GtkBox" id="box2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">5</property>
<child>
<object class="GtkCheckButton" id="EnableAURButton">
<property name="label" translatable="yes">Enable AUR support</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="tooltip_text" translatable="yes">Allow Pamac to search and install packages from AUR.</property>
<property name="focus_on_click">False</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="RemoveUnrequiredDepsButton">
<property name="label" translatable="yes">Remove unrequired dependencies</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="tooltip_text" translatable="yes">When removing a package, also remove those dependencies that are not required by other packages.</property>
<property name="focus_on_click">False</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">5</property>
<child>
<object class="GtkLabel" id="RefreshPeriodLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">3</property>
<property name="label" translatable="yes">How often to check for updates, value in hours:</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkSpinButton" id="RefreshPeriodSpinButton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">How often to check for updates, value in hours.</property>
<property name="margin_right">3</property>
<property name="caps_lock_warning">False</property>
<property name="input_purpose">number</property>
<property name="adjustment">adjustment1</property>
<property name="numeric">True</property>
<property name="update_policy">if-valid</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
</child>
<child type="tab">
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Options</property>
</object>
<packing>
<property name="tab_fill">False</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButtonBox" id="buttonbox2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">5</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="PreferencesValidButton">
<property name="label">gtk-ok</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="on_PreferencesValidButton_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="PreferencesCloseButton">
<property name="label">gtk-close</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="on_PreferencesCloseButton_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
<object class="GtkListStore" id="choose_list"> <object class="GtkListStore" id="choose_list">
<columns> <columns>
<!-- column-name gboolean1 --> <!-- column-name gboolean1 -->
@ -527,6 +446,111 @@
<column type="gchararray"/> <column type="gchararray"/>
</columns> </columns>
</object> </object>
<object class="GtkDialog" id="ChooseDialog">
<property name="can_focus">False</property>
<property name="title" translatable="yes">Choose</property>
<property name="modal">True</property>
<property name="window_position">center-on-parent</property>
<property name="icon_name">system-software-install</property>
<property name="type_hint">dialog</property>
<property name="deletable">False</property>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child internal-child="action_area">
<object class="GtkButtonBox" id="dialog-action_area1">
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="ChooseButton">
<property name="label">gtk-ok</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="on_ChooseButton_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="choose_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow5">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="shadow_type">in</property>
<property name="min_content_width">300</property>
<property name="min_content_height">250</property>
<child>
<object class="GtkTreeView" id="treeview5">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="model">choose_list</property>
<property name="headers_visible">False</property>
<property name="headers_clickable">False</property>
<property name="enable_search">False</property>
<property name="show_expanders">False</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection5">
<property name="mode">none</property>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="treeviewcolumn1">
<property name="sizing">autosize</property>
<child>
<object class="GtkCellRendererToggle" id="choose_renderertoggle">
<signal name="toggled" handler="on_choose_renderertoggle_toggled" swapped="no"/>
</object>
<attributes>
<attribute name="active">0</attribute>
</attributes>
</child>
<child>
<object class="GtkCellRendererText" id="choose_renderertext"/>
<attributes>
<attribute name="text">1</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
</child>
<action-widgets>
<action-widget response="0">ChooseButton</action-widget>
</action-widgets>
</object>
<object class="GtkListStore" id="transaction_sum"> <object class="GtkListStore" id="transaction_sum">
<columns> <columns>
<!-- column-name action --> <!-- column-name action -->
@ -535,4 +559,149 @@
<column type="gchararray"/> <column type="gchararray"/>
</columns> </columns>
</object> </object>
<object class="GtkWindow" id="ConfDialog">
<property name="can_focus">False</property>
<property name="border_width">5</property>
<property name="title" translatable="yes">Summary</property>
<property name="modal">True</property>
<property name="window_position">center-on-parent</property>
<property name="icon_name">system-software-install</property>
<property name="type_hint">dialog</property>
<property name="deletable">False</property>
<child>
<object class="GtkBox" id="box7">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">5</property>
<child>
<object class="GtkLabel" id="sum_top_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="shadow_type">in</property>
<property name="min_content_width">330</property>
<property name="min_content_height">250</property>
<child>
<object class="GtkTreeView" id="treeview4">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="model">transaction_sum</property>
<property name="headers_visible">False</property>
<property name="headers_clickable">False</property>
<property name="enable_search">False</property>
<property name="show_expanders">False</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection">
<property name="mode">none</property>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="_action">
<property name="sizing">autosize</property>
<child>
<object class="GtkCellRendererText" id="cellrenderertext5">
<property name="yalign">0</property>
<property name="weight">600</property>
</object>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="_packages">
<property name="sizing">autosize</property>
<child>
<object class="GtkCellRendererText" id="cellrenderertext6"/>
<attributes>
<attribute name="text">1</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="sum_bottom_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkButtonBox" id="buttonbox1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">7</property>
<property name="homogeneous">True</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="TransCancelButton">
<property name="label">gtk-cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="has_focus">True</property>
<property name="is_focus">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="on_TransCancelButton_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="TransValidButton">
<property name="label">gtk-ok</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="on_TransValidButton_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
</object>
</child>
</object>
</interface> </interface>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.16.0 on Wed Nov 6 15:14:37 2013 --> <!-- Generated with glade 3.16.1 -->
<interface> <interface>
<!-- interface-requires gtk+ 3.6 --> <requires lib="gtk+" version="3.6"/>
<object class="GtkAboutDialog" id="AboutDialog"> <object class="GtkAboutDialog" id="AboutDialog">
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="border_width">5</property> <property name="border_width">5</property>
@ -36,6 +36,116 @@
</object> </object>
</child> </child>
</object> </object>
<object class="GtkImage" id="cancel_icon">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-cancel</property>
</object>
<object class="GtkListStore" id="deps_list">
<columns>
<!-- column-name dep_type -->
<column type="gchararray"/>
<!-- column-name deps -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkListStore" id="details_list">
<columns>
<!-- column-name info_type -->
<column type="gchararray"/>
<!-- column-name _info -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkListStore" id="files_list">
<columns>
<!-- column-name file -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkListStore" id="groups_list">
<columns>
<!-- column-name name -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkImage" id="local_icon">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="pixel_size">16</property>
<property name="icon_name">emblem-package</property>
</object>
<object class="GtkMenu" id="main_menu">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkImageMenuItem" id="refresh_item">
<property name="label">gtk-refresh</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
<signal name="activate" handler="on_refresh_item_activate" swapped="no"/>
</object>
</child>
<child>
<object class="GtkSeparatorMenuItem" id="separatormenuitem1">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
</child>
<child>
<object class="GtkImageMenuItem" id="local_item">
<property name="label" translatable="yes">Install local packages</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="image">local_icon</property>
<property name="use_stock">False</property>
<signal name="activate" handler="on_local_item_activate" swapped="no"/>
</object>
</child>
<child>
<object class="GtkSeparatorMenuItem" id="separatormenuitem2">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
</child>
<child>
<object class="GtkImageMenuItem" id="preferences_item">
<property name="label">gtk-preferences</property>
<property name="visible">True</property>
<property name="can_focus">False</property>>
<property name="use_stock">True</property>
<signal name="activate" handler="on_preferences_item_activate" swapped="no"/>
</object>
</child>
<child>
<object class="GtkSeparatorMenuItem" id="separatormenuitem3">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
</child>
<child>
<object class="GtkImageMenuItem" id="about_item">
<property name="label">gtk-about</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
<signal name="activate" handler="on_about_item_activate" swapped="no"/>
</object>
</child>
</object>
<object class="GtkImage" id="menu_icon">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-execute</property>
</object>
<object class="GtkFileFilter" id="package_filter">
<mime-types>
<mime-type>application/x-xz-compressed-tar</mime-type>
</mime-types>
</object>
<object class="GtkFileChooserDialog" id="PackagesChooserDialog"> <object class="GtkFileChooserDialog" id="PackagesChooserDialog">
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="border_width">5</property> <property name="border_width">5</property>
@ -105,39 +215,43 @@
<action-widget response="0">package_open_button</action-widget> <action-widget response="0">package_open_button</action-widget>
</action-widgets> </action-widgets>
</object> </object>
<object class="GtkImage" id="cancel_icon"> <object class="GtkListStore" id="packages_list">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-cancel</property>
</object>
<object class="GtkListStore" id="deps_list">
<columns> <columns>
<!-- column-name dep_type --> <!-- column-name name -->
<column type="gchararray"/> <column type="gchararray"/>
<!-- column-name deps --> <!-- column-name installed -->
<column type="gboolean"/>
<!-- column-name size_string -->
<column type="gchararray"/>
<!-- column-name real_size -->
<column type="gdouble"/>
<!-- column-name version -->
<column type="gchararray"/> <column type="gchararray"/>
</columns> </columns>
</object> </object>
<object class="GtkListStore" id="details_list"> <object class="GtkListStore" id="repos_list">
<columns>
<!-- column-name info_type -->
<column type="gchararray"/>
<!-- column-name _info -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkListStore" id="files_list">
<columns>
<!-- column-name file -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkListStore" id="groups_list">
<columns> <columns>
<!-- column-name name --> <!-- column-name name -->
<column type="gchararray"/> <column type="gchararray"/>
</columns> </columns>
</object> </object>
<object class="GtkListStore" id="search_list">
<columns>
<!-- column-name terms -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkListStore" id="states_list">
<columns>
<!-- column-name state -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkImage" id="valid_icon">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-ok</property>
</object>
<object class="GtkWindow" id="ManagerWindow"> <object class="GtkWindow" id="ManagerWindow">
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="border_width">2</property> <property name="border_width">2</property>
@ -838,103 +952,4 @@
</object> </object>
</child> </child>
</object> </object>
<object class="GtkImage" id="local_icon">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="pixel_size">16</property>
<property name="icon_name">emblem-package</property>
</object>
<object class="GtkMenu" id="main_menu">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkImageMenuItem" id="refresh_item">
<property name="label">gtk-refresh</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
<signal name="activate" handler="on_refresh_item_activate" swapped="no"/>
</object>
</child>
<child>
<object class="GtkSeparatorMenuItem" id="separatormenuitem1">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
</child>
<child>
<object class="GtkImageMenuItem" id="local_item">
<property name="label" translatable="yes">Install local packages</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="image">local_icon</property>
<property name="use_stock">False</property>
<signal name="activate" handler="on_local_item_activate" swapped="no"/>
</object>
</child>
<child>
<object class="GtkSeparatorMenuItem" id="separatormenuitem2">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
</child>
<child>
<object class="GtkImageMenuItem" id="about_item">
<property name="label">gtk-about</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
<signal name="activate" handler="on_about_item_activate" swapped="no"/>
</object>
</child>
</object>
<object class="GtkImage" id="menu_icon">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-execute</property>
</object>
<object class="GtkFileFilter" id="package_filter">
<mime-types>
<mime-type>application/x-xz-compressed-tar</mime-type>
</mime-types>
</object>
<object class="GtkListStore" id="packages_list">
<columns>
<!-- column-name name -->
<column type="gchararray"/>
<!-- column-name installed -->
<column type="gboolean"/>
<!-- column-name size_string -->
<column type="gchararray"/>
<!-- column-name real_size -->
<column type="gdouble"/>
<!-- column-name version -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkListStore" id="repos_list">
<columns>
<!-- column-name name -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkListStore" id="search_list">
<columns>
<!-- column-name terms -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkListStore" id="states_list">
<columns>
<!-- column-name state -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkImage" id="valid_icon">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-ok</property>
</object>
</interface> </interface>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.16.0 on Sat Nov 9 11:57:52 2013 --> <!-- Generated with glade 3.16.1 -->
<interface> <interface>
<!-- interface-requires gtk+ 3.6 --> <requires lib="gtk+" version="3.6"/>
<object class="GtkListStore" id="transaction_add"> <object class="GtkListStore" id="transaction_add">
<columns> <columns>
<!-- column-name action --> <!-- column-name action -->
@ -23,26 +23,35 @@
<property name="border_width">5</property> <property name="border_width">5</property>
<property name="title" translatable="yes">Update Manager</property> <property name="title" translatable="yes">Update Manager</property>
<property name="window_position">center</property> <property name="window_position">center</property>
<property name="default_width">500</property>
<property name="icon_name">system-software-update</property> <property name="icon_name">system-software-update</property>
<signal name="delete-event" handler="on_UpdaterWindow_delete_event" swapped="no"/> <signal name="delete-event" handler="on_UpdaterWindow_delete_event" swapped="no"/>
<child> <child>
<object class="GtkBox" id="box1"> <object class="GtkBox" id="box1">
<property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="vexpand">True</property> <property name="vexpand">True</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="spacing">8</property> <property name="spacing">8</property>
<child> <child>
<object class="GtkBox" id="box2"> <object class="GtkBox" id="box6">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkButtonBox" id="buttonbox2">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="spacing">5</property> <property name="spacing">5</property>
<property name="layout_style">start</property>
<child> <child>
<object class="GtkImage" id="updater_image"> <object class="GtkButton" id="UpdaterPreferencesButton">
<property name="label">gtk-preferences</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">True</property>
<property name="pixel_size">48</property> <property name="receives_default">True</property>
<property name="icon_name">system-software-update</property> <property name="use_stock">True</property>
<signal name="clicked" handler="on_UpdaterPreferencesButton_clicked" swapped="no"/>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
@ -50,17 +59,6 @@
<property name="position">0</property> <property name="position">0</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkLabel" id="update_top_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
@ -70,6 +68,7 @@
</child> </child>
<child> <child>
<object class="GtkButtonBox" id="buttonbox1"> <object class="GtkButtonBox" id="buttonbox1">
<property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="has_focus">True</property> <property name="has_focus">True</property>
<property name="spacing">5</property> <property name="spacing">5</property>
@ -120,6 +119,14 @@
</packing> </packing>
</child> </child>
</object> </object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">True</property>
@ -127,6 +134,42 @@
<property name="position">0</property> <property name="position">0</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkBox" id="box2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">5</property>
<child>
<object class="GtkImage" id="updater_image">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="pixel_size">48</property>
<property name="icon_name">system-software-update</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="update_top_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child> <child>
<object class="GtkScrolledWindow" id="scrolledwindow1"> <object class="GtkScrolledWindow" id="scrolledwindow1">
<property name="width_request">400</property> <property name="width_request">400</property>

View File

@ -152,6 +152,10 @@ class PamacDBusService(dbus.service.Object):
def EmitTransactionError(self, message): def EmitTransactionError(self, message):
pass pass
@dbus.service.signal('org.manjaro.pamac')
def EmitReloadConfig(self, message):
pass
def cb_event(self, event, tupel): def cb_event(self, event, tupel):
action = self.previous_action action = self.previous_action
action_long = self.previous_action_long action_long = self.previous_action_long
@ -392,9 +396,10 @@ class PamacDBusService(dbus.service.Object):
def cb_progress(self, event, target, _percent, n, i): def cb_progress(self, event, target, _percent, n, i):
if event in ('ALPM_PROGRESS_ADD_START', 'ALPM_PROGRESS_UPGRADE_START', 'ALPM_PROGRESS_DOWNGRADE_START', 'ALPM_PROGRESS_REINSTALL_START', 'ALPM_PROGRESS_REMOVE_START'): if event in ('ALPM_PROGRESS_ADD_START', 'ALPM_PROGRESS_UPGRADE_START', 'ALPM_PROGRESS_DOWNGRADE_START', 'ALPM_PROGRESS_REINSTALL_START', 'ALPM_PROGRESS_REMOVE_START'):
percent = round(((i-1)/n)+(_percent/(100*n)), 2) percent = round(((i-1)/n)+(_percent/(100*n)), 2)
self.EmitTransactionStart('')
else: else:
percent = round(_percent/100, 2) percent = round(_percent/100, 2)
if percent == 0:
self.EmitTransactionStart('')
if target != self.previous_target: if target != self.previous_target:
self.previous_target = target self.previous_target = target
if percent != self.previous_percent: if percent != self.previous_percent:
@ -453,6 +458,7 @@ class PamacDBusService(dbus.service.Object):
syncfirst = True syncfirst = True
updates.append((candidate.name, candidate.version, candidate.db.name, '', candidate.download_size)) updates.append((candidate.name, candidate.version, candidate.db.name, '', candidate.download_size))
if not updates: if not updates:
if config.enable_aur:
if not self.aur_updates_checked: if not self.aur_updates_checked:
self.get_local_packages() self.get_local_packages()
self.local_packages -= _ignorepkgs self.local_packages -= _ignorepkgs
@ -481,7 +487,6 @@ class PamacDBusService(dbus.service.Object):
error = '' error = ''
for db in self.syncdbs: for db in self.syncdbs:
try: try:
print(db.name)
self.t = self.handle.init_transaction() self.t = self.handle.init_transaction()
db.update(force = bool(force_update)) db.update(force = bool(force_update))
self.t.release() self.t.release()
@ -763,6 +768,47 @@ class PamacDBusService(dbus.service.Object):
common.rm_pid_file() common.rm_pid_file()
mainloop.quit() mainloop.quit()
@dbus.service.method('org.manjaro.pamac', 'a(ss)', '', sender_keyword='sender', connection_keyword='connexion')
def WriteConfig(self, array, sender=None, connexion=None):
try:
authorized = self.policykit_test(sender,connexion,'org.manjaro.pamac.write_config')
except dbus.exceptions.DBusException as e:
self.EmitLogError(_('Authentication failed'))
else:
if authorized:
with open('/etc/pamac.conf', 'r') as conffile:
data = conffile.readlines()
i = 0
while i < len(data):
line = data[i].strip()
if len(line) == 0:
i += 1
continue
if line[0] == '#':
line = line.lstrip('#')
if line == '\n':
i += 1
continue
old_key, equal, old_value = [x.strip() for x in line.partition('=')]
for tupel in array:
new_key = tupel[0]
new_value = tupel[1]
if old_key == new_key:
# i is equal to the line number where we find the key in the file
if new_key in config.SINGLE_OPTIONS:
data[i] = '{} = {}\n'.format(new_key, new_value)
elif new_key in config.BOOLEAN_OPTIONS:
if new_value == 'False':
data[i] = '#{}\n'.format(new_key)
else:
data[i] = '{}\n'.format(new_key)
i += 1
with open('/etc/pamac.conf', 'w') as conffile:
conffile.writelines(data)
self.EmitReloadConfig('')
else:
self.EmitLogError(_('Authentication failed'))
GObject.threads_init() GObject.threads_init()
DBusGMainLoop(set_as_default = True) DBusGMainLoop(set_as_default = True)
myservice = PamacDBusService() myservice = PamacDBusService()

View File

@ -77,6 +77,7 @@ PackagesChooserDialog = interface.get_object('PackagesChooserDialog')
files_buffer = files_textview.get_buffer() files_buffer = files_textview.get_buffer()
AboutDialog.set_version(version) AboutDialog.set_version(version)
search_aur_button.set_visible(config.enable_aur)
search_dict = {} search_dict = {}
groups_dict = {} groups_dict = {}
@ -470,6 +471,13 @@ def handle_updates(updates):
if error: if error:
handle_error(error) handle_error(error)
def reload_config(msg):
config.pamac_conf.reload()
if config.enable_aur == False:
search_aur_button.set_active(False)
search_aur_button.set_visible(config.enable_aur)
transaction.get_updates()
def on_ManagerWindow_delete_event(*args): def on_ManagerWindow_delete_event(*args):
transaction.StopDaemon() transaction.StopDaemon()
common.rm_pid_file() common.rm_pid_file()
@ -748,7 +756,7 @@ def on_manager_valid_button_clicked(*args):
ManagerWindow.get_window().set_cursor(Gdk.Cursor(Gdk.CursorType.WATCH)) ManagerWindow.get_window().set_cursor(Gdk.Cursor(Gdk.CursorType.WATCH))
while Gtk.events_pending(): while Gtk.events_pending():
Gtk.main_iteration() Gtk.main_iteration()
error = transaction.run() error = transaction.run(recurse = config.recurse)
ManagerWindow.get_window().set_cursor(None) ManagerWindow.get_window().set_cursor(None)
if error: if error:
handle_error(error) handle_error(error)
@ -776,6 +784,12 @@ def on_local_item_activate(*args):
while Gtk.events_pending(): while Gtk.events_pending():
Gtk.main_iteration() Gtk.main_iteration()
def on_preferences_item_activate(*args):
transaction.EnableAURButton.set_active(config.enable_aur)
transaction.RemoveUnrequiredDepsButton.set_active(config.recurse)
transaction.RefreshPeriodSpinButton.set_value(config.refresh_period)
transaction.PreferencesWindow.show()
def on_about_item_activate(*args): def on_about_item_activate(*args):
response = AboutDialog.run() response = AboutDialog.run()
if response: if response:
@ -856,6 +870,8 @@ signals = {'on_ManagerWindow_delete_event' : on_ManagerWindow_delete_event,
'on_TransValidButton_clicked' : on_TransValidButton_clicked, 'on_TransValidButton_clicked' : on_TransValidButton_clicked,
'on_TransCancelButton_clicked' : on_TransCancelButton_clicked, 'on_TransCancelButton_clicked' : on_TransCancelButton_clicked,
'on_ChooseButton_clicked' : transaction.on_ChooseButton_clicked, 'on_ChooseButton_clicked' : transaction.on_ChooseButton_clicked,
'on_PreferencesCloseButton_clicked' : transaction.on_PreferencesCloseButton_clicked,
'on_PreferencesValidButton_clicked' : transaction.on_PreferencesValidButton_clicked,
'on_progress_textview_size_allocate' : transaction.on_progress_textview_size_allocate, 'on_progress_textview_size_allocate' : transaction.on_progress_textview_size_allocate,
'on_choose_renderertoggle_toggled' : transaction.on_choose_renderertoggle_toggled, 'on_choose_renderertoggle_toggled' : transaction.on_choose_renderertoggle_toggled,
'on_ProgressCancelButton_clicked' : on_ProgressCancelButton_clicked, 'on_ProgressCancelButton_clicked' : on_ProgressCancelButton_clicked,
@ -874,6 +890,7 @@ signals = {'on_ManagerWindow_delete_event' : on_ManagerWindow_delete_event,
'on_manager_cancel_button_clicked' : on_manager_cancel_button_clicked, 'on_manager_cancel_button_clicked' : on_manager_cancel_button_clicked,
'on_refresh_item_activate' : on_refresh_item_activate, 'on_refresh_item_activate' : on_refresh_item_activate,
'on_local_item_activate' : on_local_item_activate, 'on_local_item_activate' : on_local_item_activate,
'on_preferences_item_activate' : on_preferences_item_activate,
'on_about_item_activate' : on_about_item_activate, 'on_about_item_activate' : on_about_item_activate,
'on_package_open_button_clicked' : on_package_open_button_clicked, 'on_package_open_button_clicked' : on_package_open_button_clicked,
'on_package_cancel_button_clicked' : on_package_cancel_button_clicked, 'on_package_cancel_button_clicked' : on_package_cancel_button_clicked,
@ -889,6 +906,7 @@ def config_dbus_signals():
bus.add_signal_receiver(handle_reply, dbus_interface = "org.manjaro.pamac", signal_name = "EmitTransactionDone") bus.add_signal_receiver(handle_reply, dbus_interface = "org.manjaro.pamac", signal_name = "EmitTransactionDone")
bus.add_signal_receiver(handle_error, dbus_interface = "org.manjaro.pamac", signal_name = "EmitTransactionError") bus.add_signal_receiver(handle_error, dbus_interface = "org.manjaro.pamac", signal_name = "EmitTransactionError")
bus.add_signal_receiver(handle_updates, dbus_interface = "org.manjaro.pamac", signal_name = "EmitAvailableUpdates") bus.add_signal_receiver(handle_updates, dbus_interface = "org.manjaro.pamac", signal_name = "EmitAvailableUpdates")
bus.add_signal_receiver(reload_config, dbus_interface = "org.manjaro.pamac", signal_name = "EmitReloadConfig")
if common.pid_file_exists(): if common.pid_file_exists():
transaction.ErrorDialog.format_secondary_text(_('Pamac is already running')) transaction.ErrorDialog.format_secondary_text(_('Pamac is already running'))
@ -908,7 +926,7 @@ else:
size_column.set_cell_data_func(size_renderertext, size_column_display_func) size_column.set_cell_data_func(size_renderertext, size_column_display_func)
transaction.get_handle() transaction.get_handle()
update_lists() update_lists()
ManagerWindow.show_all() ManagerWindow.show()
ManagerWindow.get_window().set_cursor(Gdk.Cursor(Gdk.CursorType.WATCH)) ManagerWindow.get_window().set_cursor(Gdk.Cursor(Gdk.CursorType.WATCH))
transaction.refresh() transaction.refresh()
while Gtk.events_pending(): while Gtk.events_pending():

View File

@ -25,7 +25,7 @@ from dbus.mainloop.glib import DBusGMainLoop
from threading import Thread from threading import Thread
from time import sleep from time import sleep
from pamac import common from pamac import common, config
# i18n # i18n
import gettext import gettext
@ -130,12 +130,23 @@ def set_icon(update_data):
print(info) print(info)
tray.update_icon(icon, info) tray.update_icon(icon, info)
def launch_refresh_timeout():
# GObject timeout is in milliseconds
global refresh_timeout_id
refresh_timeout_id = GObject.timeout_add(config.refresh_period*3600*1000, refresh)
def relaunch_refresh_timeout(msg):
config.pamac_conf.reload()
GObject.source_remove(refresh_timeout_id)
launch_refresh_timeout()
DBusGMainLoop(set_as_default = True) DBusGMainLoop(set_as_default = True)
bus = dbus.SystemBus() bus = dbus.SystemBus()
bus.add_signal_receiver(set_icon, dbus_interface = "org.manjaro.pamac", signal_name = "EmitAvailableUpdates") bus.add_signal_receiver(set_icon, dbus_interface = "org.manjaro.pamac", signal_name = "EmitAvailableUpdates")
bus.add_signal_receiver(reload_config, dbus_interface = "org.manjaro.pamac", signal_name = "EmitReloadConfig")
tray = Tray() tray = Tray()
Notify.init(_('Update Manager')) Notify.init(_('Update Manager'))
refresh() refresh()
GObject.timeout_add(3*3600*1000, refresh) launch_refresh_timeout()
GObject.idle_add(check_pacman_running) GObject.idle_add(check_pacman_running)
Gtk.main() Gtk.main()

View File

@ -22,7 +22,7 @@ from gi.repository import Gtk, Gdk
import pyalpm import pyalpm
import dbus import dbus
from pamac import config, common, transaction, aur from pamac import config, common, transaction
# i18n # i18n
import gettext import gettext
@ -119,6 +119,10 @@ def handle_updates(updates):
transaction.available_updates = updates transaction.available_updates = updates
have_updates() have_updates()
def reload_config(msg):
config.pamac_conf.reload()
transaction.get_updates()
def on_UpdaterWindow_delete_event(*args): def on_UpdaterWindow_delete_event(*args):
transaction.StopDaemon() transaction.StopDaemon()
common.rm_pid_file() common.rm_pid_file()
@ -162,6 +166,12 @@ def on_ProgressCancelButton_clicked(*args):
while Gtk.events_pending(): while Gtk.events_pending():
Gtk.main_iteration() Gtk.main_iteration()
def on_UpdaterPreferencesButton_clicked(*args):
transaction.EnableAURButton.set_active(config.enable_aur)
transaction.RemoveUnrequiredDepsButton.set_active(config.recurse)
transaction.RefreshPeriodSpinButton.set_value(config.refresh_period)
transaction.PreferencesWindow.show()
def on_Updater_ApplyButton_clicked(*args): def on_Updater_ApplyButton_clicked(*args):
UpdaterWindow.get_window().set_cursor(Gdk.Cursor(Gdk.CursorType.WATCH)) UpdaterWindow.get_window().set_cursor(Gdk.Cursor(Gdk.CursorType.WATCH))
while Gtk.events_pending(): while Gtk.events_pending():
@ -184,11 +194,14 @@ def on_Updater_CloseButton_clicked(*args):
signals = {'on_ChooseButton_clicked' : transaction.on_ChooseButton_clicked, signals = {'on_ChooseButton_clicked' : transaction.on_ChooseButton_clicked,
'on_progress_textview_size_allocate' : transaction.on_progress_textview_size_allocate, 'on_progress_textview_size_allocate' : transaction.on_progress_textview_size_allocate,
'on_choose_renderertoggle_toggled' : transaction.on_choose_renderertoggle_toggled, 'on_choose_renderertoggle_toggled' : transaction.on_choose_renderertoggle_toggled,
'on_PreferencesCloseButton_clicked' : transaction.on_PreferencesCloseButton_clicked,
'on_PreferencesValidButton_clicked' : transaction.on_PreferencesValidButton_clicked,
'on_TransValidButton_clicked' :on_TransValidButton_clicked, 'on_TransValidButton_clicked' :on_TransValidButton_clicked,
'on_TransCancelButton_clicked' :on_TransCancelButton_clicked, 'on_TransCancelButton_clicked' :on_TransCancelButton_clicked,
'on_ProgressCloseButton_clicked' : on_ProgressCloseButton_clicked, 'on_ProgressCloseButton_clicked' : on_ProgressCloseButton_clicked,
'on_ProgressCancelButton_clicked' : on_ProgressCancelButton_clicked, 'on_ProgressCancelButton_clicked' : on_ProgressCancelButton_clicked,
'on_UpdaterWindow_delete_event' : on_UpdaterWindow_delete_event, 'on_UpdaterWindow_delete_event' : on_UpdaterWindow_delete_event,
'on_UpdaterPreferencesButton_clicked': on_UpdaterPreferencesButton_clicked,
'on_Updater_ApplyButton_clicked' : on_Updater_ApplyButton_clicked, 'on_Updater_ApplyButton_clicked' : on_Updater_ApplyButton_clicked,
'on_Updater_RefreshButton_clicked' : on_Updater_RefreshButton_clicked, 'on_Updater_RefreshButton_clicked' : on_Updater_RefreshButton_clicked,
'on_Updater_CloseButton_clicked' : on_Updater_CloseButton_clicked} 'on_Updater_CloseButton_clicked' : on_Updater_CloseButton_clicked}
@ -198,6 +211,7 @@ def config_dbus_signals():
bus.add_signal_receiver(handle_reply, dbus_interface = "org.manjaro.pamac", signal_name = "EmitTransactionDone") bus.add_signal_receiver(handle_reply, dbus_interface = "org.manjaro.pamac", signal_name = "EmitTransactionDone")
bus.add_signal_receiver(handle_error, dbus_interface = "org.manjaro.pamac", signal_name = "EmitTransactionError") bus.add_signal_receiver(handle_error, dbus_interface = "org.manjaro.pamac", signal_name = "EmitTransactionError")
bus.add_signal_receiver(handle_updates, dbus_interface = "org.manjaro.pamac", signal_name = "EmitAvailableUpdates") bus.add_signal_receiver(handle_updates, dbus_interface = "org.manjaro.pamac", signal_name = "EmitAvailableUpdates")
bus.add_signal_receiver(reload_config, dbus_interface = "org.manjaro.pamac", signal_name = "EmitReloadConfig")
if common.pid_file_exists(): if common.pid_file_exists():
transaction.ErrorDialog.format_secondary_text(_('Pamac is already running')) transaction.ErrorDialog.format_secondary_text(_('Pamac is already running'))
@ -210,7 +224,7 @@ else:
transaction.get_dbus_methods() transaction.get_dbus_methods()
transaction.config_dbus_signals() transaction.config_dbus_signals()
config_dbus_signals() config_dbus_signals()
UpdaterWindow.show_all() UpdaterWindow.show()
UpdaterWindow.get_window().set_cursor(Gdk.Cursor(Gdk.CursorType.WATCH)) UpdaterWindow.get_window().set_cursor(Gdk.Cursor(Gdk.CursorType.WATCH))
while Gtk.events_pending(): while Gtk.events_pending():
Gtk.main_iteration() Gtk.main_iteration()

View File

@ -60,7 +60,8 @@ SINGLE_OPTIONS = (
'CleanMethod', 'CleanMethod',
'SigLevel', 'SigLevel',
'LocalFileSigLevel', 'LocalFileSigLevel',
'RemoteFileSigLevel' 'RemoteFileSigLevel',
'RefreshPeriod'
) )
BOOLEAN_OPTIONS = ( BOOLEAN_OPTIONS = (
@ -69,7 +70,9 @@ BOOLEAN_OPTIONS = (
'CheckSpace', 'CheckSpace',
'VerbosePkgLists', 'VerbosePkgLists',
'ILoveCandy', 'ILoveCandy',
'Color' 'Color',
'EnableAUR',
'RemoveUnrequiredDeps'
) )
def define_siglevel(default_level, conf_string): def define_siglevel(default_level, conf_string):
@ -186,7 +189,7 @@ def pacman_conf_enumerator(path):
else: else:
warnings.warn(InvalidSyntax(f.name, 'unrecognized option', key)) warnings.warn(InvalidSyntax(f.name, 'unrecognized option', key))
class PacmanConfig: class PacmanConfig():
def __init__(self, conf = None, options = None): def __init__(self, conf = None, options = None):
self.options = {} self.options = {}
self.repos = collections.OrderedDict() self.repos = collections.OrderedDict()
@ -292,8 +295,79 @@ class PacmanConfig:
def __str__(self): def __str__(self):
return("PacmanConfig(options={}, repos={})".format(self.options, self.repos)) return("PacmanConfig(options={}, repos={})".format(self.options, self.repos))
def pamac_conf_enumerator(path):
filestack = []
current_section = None
filestack.append(open(path))
while len(filestack) > 0:
f = filestack[-1]
line = f.readline()
if len(line) == 0:
# end of file
filestack.pop()
continue
line = line.strip()
if len(line) == 0:
continue
if line[0] == '#':
continue
# read key, value
key, equal, value = [x.strip() for x in line.partition('=')]
if equal == '=':
if key in LIST_OPTIONS:
for val in value.split():
yield (current_section, key, val)
elif key in SINGLE_OPTIONS:
if key == 'RefreshPeriod':
yield (current_section, key, int(value))
else:
yield (current_section, key, value)
else:
warnings.warn(InvalidSyntax(f.name, 'unrecognized option', key))
else:
if key in BOOLEAN_OPTIONS:
yield (current_section, key, True)
else:
warnings.warn(InvalidSyntax(f.name, 'unrecognized option', key))
class PamacConfig():
def __init__(self, conf = None):
self.options = {}
self.options["RefreshPeriod"] = 3600*3
self.options["EnableAUR"] = False
self.options["RemoveUnrequiredDeps"] = False
if conf:
self.load_from_file(conf)
def load_from_file(self, filename):
for section, key, value in pamac_conf_enumerator(filename):
if key in LIST_OPTIONS:
self.options.setdefault(key, []).append(value)
else:
self.options[key] = value
self.set_global_variables()
def set_global_variables(self):
global refresh_period
global enable_aur
global recurse
refresh_period = self.options['RefreshPeriod']
enable_aur = self.options['EnableAUR']
recurse = self.options['RemoveUnrequiredDeps']
def reload(self):
self.options["EnableAUR"] = False
self.options["RemoveUnrequiredDeps"] = False
self.load_from_file("/etc/pamac.conf")
def __str__(self):
return("PamacConfig(options={})".format(self.options))
pacman_conf = PacmanConfig(conf = "/etc/pacman.conf") pacman_conf = PacmanConfig(conf = "/etc/pacman.conf")
handle = pacman_conf.initialize_alpm handle = pacman_conf.initialize_alpm
pamac_conf = PamacConfig(conf = "/etc/pamac.conf")
holdpkg = [] holdpkg = []
syncfirst = [] syncfirst = []
if 'HoldPkg' in pacman_conf.options: if 'HoldPkg' in pacman_conf.options:

View File

@ -67,7 +67,7 @@ interface.add_from_file('/usr/share/pamac/gui/dialogs.ui')
ErrorDialog = interface.get_object('ErrorDialog') ErrorDialog = interface.get_object('ErrorDialog')
WarningDialog = interface.get_object('WarningDialog') WarningDialog = interface.get_object('WarningDialog')
#InfoDialog = interface.get_object('InfoDialog') #InfoDialog = interface.get_object('InfoDialog')
#QuestionDialog = interface.get_object('QuestionDialog') QuestionDialog = interface.get_object('QuestionDialog')
ConfDialog = interface.get_object('ConfDialog') ConfDialog = interface.get_object('ConfDialog')
transaction_sum = interface.get_object('transaction_sum') transaction_sum = interface.get_object('transaction_sum')
sum_top_label = interface.get_object('sum_top_label') sum_top_label = interface.get_object('sum_top_label')
@ -84,6 +84,10 @@ ProgressCancelButton = interface.get_object('ProgressCancelButton')
ProgressCloseButton = interface.get_object('ProgressCloseButton') ProgressCloseButton = interface.get_object('ProgressCloseButton')
progress_expander = interface.get_object('progress_expander') progress_expander = interface.get_object('progress_expander')
progress_textview = interface.get_object('progress_textview') progress_textview = interface.get_object('progress_textview')
PreferencesWindow = interface.get_object('PreferencesWindow')
EnableAURButton = interface.get_object('EnableAURButton')
RemoveUnrequiredDepsButton = interface.get_object('RemoveUnrequiredDepsButton')
RefreshPeriodSpinButton = interface.get_object('RefreshPeriodSpinButton')
progress_buffer = progress_textview.get_buffer() progress_buffer = progress_textview.get_buffer()
@ -107,6 +111,7 @@ def get_dbus_methods():
global Release global Release
global StopDaemon global StopDaemon
global SetPkgReason global SetPkgReason
global WriteConfig
SetPkgReason = proxy.get_dbus_method('SetPkgReason','org.manjaro.pamac') SetPkgReason = proxy.get_dbus_method('SetPkgReason','org.manjaro.pamac')
Refresh = proxy.get_dbus_method('Refresh','org.manjaro.pamac') Refresh = proxy.get_dbus_method('Refresh','org.manjaro.pamac')
CheckUpdates = proxy.get_dbus_method('CheckUpdates','org.manjaro.pamac') CheckUpdates = proxy.get_dbus_method('CheckUpdates','org.manjaro.pamac')
@ -122,6 +127,7 @@ def get_dbus_methods():
Interrupt = proxy.get_dbus_method('Interrupt','org.manjaro.pamac') Interrupt = proxy.get_dbus_method('Interrupt','org.manjaro.pamac')
Release = proxy.get_dbus_method('Release','org.manjaro.pamac') Release = proxy.get_dbus_method('Release','org.manjaro.pamac')
StopDaemon = proxy.get_dbus_method('StopDaemon','org.manjaro.pamac') StopDaemon = proxy.get_dbus_method('StopDaemon','org.manjaro.pamac')
WriteConfig = proxy.get_dbus_method('WriteConfig','org.manjaro.pamac')
def config_dbus_signals(): def config_dbus_signals():
bus.add_signal_receiver(action_handler, dbus_interface = "org.manjaro.pamac", signal_name = "EmitAction") bus.add_signal_receiver(action_handler, dbus_interface = "org.manjaro.pamac", signal_name = "EmitAction")
@ -200,7 +206,7 @@ def choose_provides(data):
def on_choose_renderertoggle_toggled(widget, line): def on_choose_renderertoggle_toggled(widget, line):
choose_list[line][0] = not choose_list[line][0] choose_list[line][0] = not choose_list[line][0]
def on_ChooseButton_clicked(*arg): def on_ChooseButton_clicked(*args):
ChooseDialog.hide() ChooseDialog.hide()
while Gtk.events_pending(): while Gtk.events_pending():
Gtk.main_iteration() Gtk.main_iteration()
@ -208,11 +214,26 @@ def on_ChooseButton_clicked(*arg):
if row[0] is True: if row[0] is True:
to_add.add(row[1].split(':')[0]) # split done in case of optdep choice to_add.add(row[1].split(':')[0]) # split done in case of optdep choice
def on_progress_textview_size_allocate(*arg): def on_progress_textview_size_allocate(*args):
#auto-scrolling method #auto-scrolling method
adj = progress_textview.get_vadjustment() adj = progress_textview.get_vadjustment()
adj.set_value(adj.get_upper() - adj.get_page_size()) adj.set_value(adj.get_upper() - adj.get_page_size())
def on_PreferencesValidButton_clicked(*args):
data = []
if EnableAURButton.get_active() != config.enable_aur:
data.append(('EnableAUR', str(EnableAURButton.get_active())))
if RemoveUnrequiredDepsButton.get_active() != config.recurse:
data.append(('RemoveUnrequiredDeps', str(RemoveUnrequiredDepsButton.get_active())))
if RefreshPeriodSpinButton.get_value() != config.refresh_period:
data.append(('RefreshPeriod', str(RefreshPeriodSpinButton.get_value_as_int())))
if data:
WriteConfig(data)
PreferencesWindow.hide()
def on_PreferencesCloseButton_clicked(*args):
PreferencesWindow.hide()
def get_handle(): def get_handle():
global handle global handle
global syncdbs global syncdbs
@ -380,7 +401,7 @@ def check_to_build():
print('builddeps:',build_depends) print('builddeps:',build_depends)
return error return error
def run(): def run(cascade = True, recurse = False):
if to_add or to_remove or to_load or to_build: if to_add or to_remove or to_load or to_build:
global progress_buffer global progress_buffer
action_handler(_('Preparing')+'...') action_handler(_('Preparing')+'...')
@ -404,7 +425,7 @@ def run():
if to_add or to_remove or to_load: if to_add or to_remove or to_load:
while Gtk.events_pending(): while Gtk.events_pending():
Gtk.main_iteration() Gtk.main_iteration()
trans_flags = {'cascade' : True} trans_flags = {'cascade': cascade, 'recurse': recurse}
error += init_transaction(**trans_flags) error += init_transaction(**trans_flags)
if not error: if not error:
for name in to_add: for name in to_add: