[nautilus-actions] Implements get_background_items() and get_toolbar_items() Nautilus API
- From: Pierre Wieser <pwieser src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [nautilus-actions] Implements get_background_items() and get_toolbar_items() Nautilus API
- Date: Sun, 25 Oct 2009 15:18:56 +0000 (UTC)
commit 2d493fda5ec0d94b5f6be5303fc3302d5ee8bc9a
Author: Pierre Wieser <pwieser trychlos org>
Date: Fri Oct 23 16:14:13 2009 +0200
Implements get_background_items() and get_toolbar_items() Nautilus API
ChangeLog | 74 ++-
TODO | 36 ++-
data/nautilus-actions.schemas.in | 196 +++++--
src/common/na-xml-names.h | 65 ++-
src/common/na-xml-writer.c | 116 ++++
src/nact/Makefile.am | 3 +
src/nact/nact-assistant-export.c | 2 +-
src/nact/nact-iaction-tab.c | 331 ++++++++----
src/nact/nact-iadvanced-tab.c | 57 ++-
src/nact/nact-ibackground-tab.c | 343 +++++++++++
src/nact/nact-ibackground-tab.h | 71 +++
src/nact/nact-icommand-tab.c | 42 +-
src/nact/nact-iconditions-tab.c | 93 +++-
src/nact/nact-main-tab.c | 49 ++
src/nact/nact-main-tab.h | 16 +
src/nact/nact-main-window.c | 43 ++
src/nact/nact-xml-reader.c | 39 ++-
src/nact/nautilus-actions-config-tool.ui | 930 ++++++++++++++++++------------
src/plugin/nautilus-actions.c | 135 ++++--
src/runtime/na-gconf-provider-keys.h | 18 +-
src/runtime/na-gconf-provider.c | 38 ++-
src/runtime/na-object-action-fn.h | 16 +-
src/runtime/na-object-action-priv.h | 7 +
src/runtime/na-object-action.c | 189 ++++++-
src/runtime/na-object-api.h | 6 +
src/runtime/na-object-item-fn.h | 8 +-
src/runtime/na-object-item-priv.h | 8 +
src/runtime/na-object-item.c | 269 ++++++++-
src/runtime/na-object-profile-fn.h | 14 +-
src/runtime/na-object-profile-priv.h | 27 +-
src/runtime/na-object-profile.c | 169 +++++-
src/utils/nautilus-actions-new.c | 4 +-
32 files changed, 2684 insertions(+), 730 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 009b3aa..07568c7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,24 +1,70 @@
-2009-10-21 Pierre Wieser <pwieser trychlos org>
+2009-10-23 Pierre Wieser <pwieser trychlos org>
+
+ Populates Nautilus background menus and Nautilus toolbar.
+ Defines required new properties:
+ - target_selection: whether the action is candidate to selection menus
+ - target_background: whether the action is candidate to background menus
+ - target_toolbar: whether the action is candidate to toolbar display
+ - short_label: the toolbar label
+ - use_same_label: whether the toolbar label is the same that those of the
+ action.
* data/nautilus-actions.schemas.in:
- Define new preferences for displaying toolbars.
+ * src/common/na-xml-names.h:
+ Define the new keys.
+ Make sure key descriptions are equal to those in nact-xml-names.h.
- * src/nact/nact-main-menubar.c:
- Define new View/Toolbars menu.
- Display the toolbars depending on user preferences.
+ * src/common/na-xml-writer.c
+ (create_xml_schema, create_xml_dump): Export the new keys.
+ (create_gconf_schema): Export the new schemas.
- * src/nact/nautilus-actions-config-tool.actions:
- Toolbar placeholder is now a HBox.
+ * src/nact/nact-ibackground-tab.c:
+ * src/nact/nact-ibackground-tab.h:
+ * src/nact/nact-main-tab.c: New files
- * src/nact/nact-iactions-list.c:
- Enable send of focus-in and focus-out messages.
- Do not retest focus when dealing with accelerators.
+ * src/nact/Makefile.am: Updated accordingly.
- * src/nact/nact-main-menubar.c:
- Enable edition items also when the popup is opened.
+ * src/nact/nact-assistant-export.c
+ (assistant_apply): Exported action is actually the original one,
+ not those displayed in assistant because it has no profiles.
- * src/nact/nautilus-actions-config-tool.actions:
- Only enable in toolbars items which have an icon.
+ * src/nact/nact-iaction-tab.c:
+ Define three new toggle buttons for the three target properties.
+
+ * src/nact/nact-iadvanced-tab.c:
+ * src/nact/nact-icommand-tab.c:
+ * src/nact/nact-iconditions-tab.c:
+ Set sensitivity depending on current selection.
+
+ * src/nact/nact-main-window.c:
+ Define new "enable-tab" signal.
+ Implements new NactIBackgroundTab interface.
+
+ * src/nact/nact-xml-reader.c
+ (apply_values): Import the new keys.
+ No more assert on not processed entry.
+
+ * src/nact/nautilus-actions-config-tool.ui:
+ Define three new toggle buttons to select the available targets.
+ Define new Background notebook tab.
+ Define Toolbar frame.
+
+ * src/plugin/nautilus-actions.c:
+ Implements the two other nautilus API get_background_items and
+ get_toolbar_items, both on current_folder.
+
+ * src/runtime/na-gconf-provider-keys.h:
+ * src/runtime/na-gconf-provider.c:
+ Read/write the new keys from/to IO Provider.
+
+ * src/runtime/na-object-api.h:
+ * src/runtime/na-object-item-priv.h:
+ * src/runtime/na-object-item.c:
+ * src/runtime/na-object-item-fn.h:
+ * src/runtime/na-object-action-priv.h:
+ * src/runtime/na-object-action.c:
+ * src/runtime/na-object-action-fn.h:
+ Implements the new properties.
2009-10-20 Pierre Wieser <pwieser trychlos org>
diff --git a/TODO b/TODO
index 09193c9..82b5343 100644
--- a/TODO
+++ b/TODO
@@ -38,6 +38,8 @@
- for each toolbar, let the user choose which buttons are displayed
+- make toolbars detachable
+
- have a visual indication of the sort order in the tree
- use eggsmclient
@@ -52,4 +54,36 @@
- undo manager (at least Ctrl-Z)
- ui preferences: escape quit the assistant
-- ui preferences, warn on escape before quitting
+- ui preferences: warn on escape before quitting
+- ui preferences: create root menu for background items
+- ui preferences: add about item for background items
+
+- nact_iconditions_tab_runtime_init_toplevel: use base_window_signal_connect
+ and in all tabs
+
+- check g_signal_emit_by_name TAB_UPDATABLE_SIGNAL_ITEM_UPDATED against
+ its marshalling and against the signal definition
+
+- have a single place where a schema is written
+ (see src/utils/nautilus-actions-schemas.c)
+ more: have a single place where the schema is _described_
+ so that we may generalize export, import, new, etc.
+
+- import/export menus ?
+
+- IActionTab: check_label has became useless since validity is global
+ to the action - remove, or extend to each field which can led to
+ unvalidity
+
+- action-new: add targets, folders, toolbar label
+
+- data factory: put together each property of each elementary data (id, label, etc.)
+
+- AssistantExport exports what it finds in Pivot, but should take its origin
+ from current IActionsList (a. to have same perimeter than drag and drop and
+ b. to export what we see)
+
+- AssistantExport: report
+ str->action = NA_OBJECT_ACTION( na_iduplicable_get_origin( NA_IDUPLICABLE( ia->data )));
+ to gnome-2-28
+
diff --git a/data/nautilus-actions.schemas.in b/data/nautilus-actions.schemas.in
index 01d4740..d45009b 100644
--- a/data/nautilus-actions.schemas.in
+++ b/data/nautilus-actions.schemas.in
@@ -11,7 +11,7 @@
<type>string</type>
<locale name="C">
<short>The version of the configuration format</short>
- <long>The version of the configuration format that will be used to manage backward compatibility</long>
+ <long>The version of the configuration format that will be used to manage backward compatibility.</long>
</locale>
<default>2.0</default>
</schema>
@@ -23,7 +23,7 @@
<locale name="C">
<default></default>
<short>The label of the menu item</short>
- <long>The label of the menu item that will appear in the Nautilus popup menu when the selection matches the appearance condition settings</long>
+ <long>The label of the menu item that will appear in the Nautilus popup menu when the selection matches the appearance condition settings.</long>
</locale>
<default></default>
</schema>
@@ -35,7 +35,7 @@
<locale name="C">
<default></default>
<short>The tooltip of the menu item</short>
- <long>The tooltip of the menu item that will appear in the Nautilus statusbar when the user points to the Nautilus popup menu item with his/her mouse</long>
+ <long>The tooltip of the menu item that will appear in the Nautilus statusbar when the user points to the Nautilus popup menu item with his/her mouse.</long>
</locale>
<default></default>
</schema>
@@ -46,7 +46,7 @@
<type>string</type>
<locale name="C">
<short>The icon of the menu item</short>
- <long>The icon of the menu item that will appear next to the label in the Nautilus popup menu when the selection matches the appearance conditions settings</long>
+ <long>The icon of the menu item that will appear next to the label in the Nautilus popup menu when the selection matches the appearance conditions settings.</long>
</locale>
<default></default>
</schema>
@@ -57,19 +57,103 @@
<type>bool</type>
<locale name="C">
<short>Whether the action is enabled</short>
- <long>If the action is disabled, it will never appear in the Nautilus context menu</long>
+ <long>If the action is disabled, it will never appear in the Nautilus context menu.</long>
</locale>
<default>true</default>
</schema>
<schema>
+ <key>/schemas/apps/nautilus-actions/configurations/target_selection</key>
+ <owner>nautilus-actions</owner>
+ <type>bool</type>
+ <locale name="C">
+ <short>Targets selection</short>
+ <long>Whether the action of menu targets the selection Nautilus menus. This is the historical behavior.</long>
+ </locale>
+ <default>true</default>
+ </schema>
+
+ <schema>
+ <key>/schemas/apps/nautilus-actions/configurations/target_background</key>
+ <owner>nautilus-actions</owner>
+ <type>bool</type>
+ <locale name="C">
+ <short>Targets background</short>
+ <long>Whether the action of menu targets the background Nautilus menus.</long>
+ </locale>
+ <default>false</default>
+ </schema>
+
+ <schema>
+ <key>/schemas/apps/nautilus-actions/configurations/target_toolbar</key>
+ <owner>nautilus-actions</owner>
+ <type>bool</type>
+ <locale name="C">
+ <short>Targets toolbar</short>
+ <long>Whether the action is candidate to be displayed in Nautilus toolbar.
+Note, that as of Nautilus -2.26, menus can not be candidate to toolbar display.</long>
+ </locale>
+ <default>false</default>
+ </schema>
+
+ <schema>
+ <key>/schemas/apps/nautilus-actions/configurations/items</key>
+ <owner>nautilus-actions</owner>
+ <type>list</type>
+ <list_type>string</list_type>
+ <locale name="C">
+ <short>List of subitem ids</short>
+ <long>Ordered list of the IDs of the subitems. This may be actions or menus if the item is a menu, or profiles if the item is an action.
+If this list doesn't exist or is empty for an action, we load the found profiles in the order of the read operations.</long>
+ </locale>
+ <default>[]</default>
+ </schema>
+
+ <schema>
+ <key>/schemas/apps/nautilus-actions/configurations/type</key>
+ <owner>nautilus-actions</owner>
+ <type>string</type>
+ <locale name="C">
+ <short>Type of the item</short>
+ <long>Defines if the item is an action or a menu. Possible values are :
+- "Action",
+- "Menu".
+The value is case sensitive and must not be localized.</long>
+ </locale>
+ <default>Action</default>
+ </schema>
+
+ <schema>
+ <key>/schemas/apps/nautilus-actions/configurations/toolbar-same-label</key>
+ <owner>nautilus-actions</owner>
+ <type>bool</type>
+ <locale name="C">
+ <short>Whether the labels are the sames</short>
+ <long>Whether the label displayed in the Nautilus toolbar besides of the icon is the same that the main item label.</long>
+ </locale>
+ <default>false</default>
+ </schema>
+
+ <schema>
+ <key>/schemas/apps/nautilus-actions/configurations/toolbar-label</key>
+ <owner>nautilus-actions</owner>
+ <type>bool</type>
+ <locale name="C">
+ <short>Label of the item in the toolbar</short>
+ <long>The label displayed besides of the icon in the Nautilus toolbar.
+Note that actual display may depend of your own Gnome preferences.</long>
+ </locale>
+ <default></default>
+ </schema>
+
+ <schema>
<key>/schemas/apps/nautilus-actions/configurations/desc-name</key>
<owner>nautilus-actions</owner>
<type>string</type>
<locale name="C">
<default>Default profile</default>
<short>A description name of the profile</short>
- <long>The field is here to give the user a human readable name for a profile in the Nact interface. If not set there will be a default auto generated string set by default</long>
+ <long>The field is here to give the user a human readable name for a profile in the NACT interface. If not set there will be a default auto generated string set.</long>
</locale>
<default>Default profile</default>
</schema>
@@ -80,7 +164,7 @@
<type>string</type>
<locale name="C">
<short>The path of the command</short>
- <long>The path of the command to start when the user select the menu item in the Nautilus popup menu</long>
+ <long>The path of the command to start when the user select the menu item in the Nautilus popup menu.</long>
</locale>
<default></default>
</schema>
@@ -105,7 +189,7 @@ The parameters can contain some special tokens which are replaced by Nautilus in
%s: scheme of the URI
%u: URI
%U: username of the URI
-%%: a percent sign</long>
+%%: a percent sign.</long>
</locale>
<default></default>
</schema>
@@ -117,7 +201,7 @@ The parameters can contain some special tokens which are replaced by Nautilus in
<list_type>string</list_type>
<locale name="C">
<short>The list of pattern to match the selected file(s)/folder(s)</short>
- <long>A list of strings with joker '*' or '?' to match the name of the selected file(s)/folder(s). Each selected items must match at least one of the filename patterns for the action to appear</long>
+ <long>A list of strings with joker '*' or '?' to match the name of the selected file(s)/folder(s). Each selected items must match at least one of the filename patterns for the action to appear. This only applies when targeting selection.</long>
</locale>
<default>[*]</default>
</schema>
@@ -128,7 +212,7 @@ The parameters can contain some special tokens which are replaced by Nautilus in
<type>bool</type>
<locale name="C">
<short>'true' if the filename patterns have to be case sensitive, 'false' otherwise</short>
- <long>If you need to match a filename in a case-sensitive manner, set this key to 'true'. If you also want, for example '*.jpg' to match 'photo.JPG', set 'false'</long>
+ <long>If you need to match a filename in a case-sensitive manner, set this key to 'true'. If you also want, for example '*.jpg' to match 'photo.JPG', set 'false'. This only applies when targeting selection.</long>
</locale>
<default>true</default>
</schema>
@@ -140,7 +224,7 @@ The parameters can contain some special tokens which are replaced by Nautilus in
<list_type>string</list_type>
<locale name="C">
<short>The list of patterns to match the mimetypes of the selected file(s)</short>
- <long>A list of strings with joker '*' or '?' to match the mimetypes of the selected file(s). Each selected items must match at least one of the mimetype patterns for the action to appear</long>
+ <long>A list of strings with joker '*' or '?' to match the mimetypes of the selected file(s). Each selected items must match at least one of the mimetype patterns for the action to appear. This only applies when targeting selection.</long>
</locale>
<default>[*/*]</default>
</schema>
@@ -151,12 +235,12 @@ The parameters can contain some special tokens which are replaced by Nautilus in
<type>bool</type>
<locale name="C">
<short>'true' if the selection can have files, 'false' otherwise</short>
- <long>This setting is tied in with the 'isdir' setting. The valid combinations are:
-
-isfile=TRUE and isdir=FALSE: the selection may hold only files
-isfile=FALSE and isdir=TRUE: the selection may hold only folders
-isfile=TRUE and isdir=TRUE: the selection may hold both files and folders
-isfile=FALSE and isdir=FALSE: this is an invalid combination (your configuration will never appear)</long>
+ <long>This setting is tied in with the 'isdir' setting. The valid combinations are :
+- isfile=TRUE and isdir=FALSE: the selection may hold only files
+- isfile=FALSE and isdir=TRUE: the selection may hold only folders
+- isfile=TRUE and isdir=TRUE: the selection may hold both files and folders
+- isfile=FALSE and isdir=FALSE: this is an invalid combination (your configuration will never appear).
+This only applies when targeting selection.</long>
</locale>
<default>true</default>
</schema>
@@ -167,12 +251,12 @@ isfile=FALSE and isdir=FALSE: this is an invalid combination (your configuration
<type>bool</type>
<locale name="C">
<short>'true' if the selection can have folders, 'false' otherwise</short>
- <long>This setting is tied in with the 'isfile' setting. The valid combinations are:
-
-isfile=TRUE and isdir=FALSE: the selection may hold only files
-isfile=FALSE and isdir=TRUE: the selection may hold only folders
-isfile=TRUE and isdir=TRUE: the selection may hold both files and folders
-isfile=FALSE and isdir=FALSE: this is an invalid combination (your configuration will never appear)</long>
+ <long>This setting is tied in with the 'isfile' setting. The valid combinations are :
+- isfile=TRUE and isdir=FALSE: the selection may hold only files
+- isfile=FALSE and isdir=TRUE: the selection may hold only folders
+- isfile=TRUE and isdir=TRUE: the selection may hold both files and folders
+- isfile=FALSE and isdir=FALSE: this is an invalid combination (your configuration will never appear).
+This only applies when targeting selection.</long>
</locale>
<default>false</default>
</schema>
@@ -183,7 +267,7 @@ isfile=FALSE and isdir=FALSE: this is an invalid combination (your configuration
<type>bool</type>
<locale name="C">
<short>'true' if the selection can have several items, 'false' otherwise</short>
- <long>If you need one or more files or folders to be selected, set this key to 'true'. If you want just one file or folder, set 'false'</long>
+ <long>If you need one or more files or folders to be selected, set this key to 'true'. If you want just one file or folder, set 'false'. This only applies when targeting selection.</long>
</locale>
<default>false</default>
</schema>
@@ -196,24 +280,34 @@ isfile=FALSE and isdir=FALSE: this is an invalid combination (your configuration
<locale name="C">
<short>The list of schemes where the selected files should be located</short>
<long>Defines the list of valid schemes to be matched against the selected items. The scheme is the protocol used to access the files. The keyword to use is the one used in the URI.
+Examples of valid URI include :
+- file:///tmp/foo.txt
+- sftp:///root test example net/tmp/foo.txt
-Examples of valid URI include:
-file:///tmp/foo.txt
-sftp:///root test example net/tmp/foo.txt
-
-The most common schemes are:
+The most common schemes are :
+- 'file': local files
+- 'sftp': files accessed via SSH
+- 'ftp' : files accessed via FTP
+- 'smb' : files accessed via Samba (Windows share)
+- 'dav' : files accessed via WebDAV
-'file': local files
-'sftp': files accessed via SSH
-'ftp': files accessed via FTP
-'smb': files accessed via Samba (Windows share)
-'dav': files accessed via WebDAV
-
-All schemes used by Nautilus can be used here.</long>
+All schemes used by Nautilus can be used here. This only applies when targeting selection.</long>
</locale>
<default>[file]</default>
</schema>
+ <schema>
+ <key>/schemas/apps/nautilus-actions/configurations/folders</key>
+ <owner>nautilus-actions</owner>
+ <type>list</type>
+ <list_type>string</list_type>
+ <locale name="C">
+ <short>The list of URIs on which the Background item applies</short>
+ <long>Defines the list of valid URIs to be matched against the current folder. This is only used when targeting background or toolbar. All folders 'under' the specified URI are considered valid.</long>
+ </locale>
+ <default>[]</default>
+ </schema>
+
<!-- schemas for preferences -->
<schema>
@@ -223,7 +317,7 @@ All schemes used by Nautilus can be used here.</long>
<list_type>int</list_type>
<locale name="C">
<short>Position and size of the export assistant window</short>
- <long>Position and size of the export assistant window ; default is set by the window manager</long>
+ <long>Position and size of the export assistant window ; default is set by the window manager.</long>
</locale>
<default>[]</default>
</schema>
@@ -234,7 +328,7 @@ All schemes used by Nautilus can be used here.</long>
<type>string</type>
<locale name="C">
<short>Last selected folder</short>
- <long>Last folder selected when choosing a folder where to export the actions</long>
+ <long>Last folder selected when choosing a folder where to export the actions.</long>
</locale>
<default>/tmp</default>
</schema>
@@ -246,7 +340,7 @@ All schemes used by Nautilus can be used here.</long>
<list_type>int</list_type>
<locale name="C">
<short>Position and size of the command chooser window</short>
- <long>Position and size of the command chooser window in the Command tab ; default is set by the window manager</long>
+ <long>Position and size of the command chooser window in the Command tab ; default is set by the window manager.</long>
</locale>
<default>[]</default>
</schema>
@@ -257,7 +351,7 @@ All schemes used by Nautilus can be used here.</long>
<type>string</type>
<locale name="C">
<short>Last selected folder</short>
- <long>Last folder selected when browsing for a command in the Command tab</long>
+ <long>Last folder selected when browsing for a command in the Command tab.</long>
</locale>
<default>/bin</default>
</schema>
@@ -269,7 +363,7 @@ All schemes used by Nautilus can be used here.</long>
<list_type>int</list_type>
<locale name="C">
<short>Position and size of the Legend dialog</short>
- <long>Position and size of the Legend dialog ; default is set by the UI manager</long>
+ <long>Position and size of the Legend dialog ; default is set by the UI manager.</long>
</locale>
<default>[]</default>
</schema>
@@ -281,7 +375,7 @@ All schemes used by Nautilus can be used here.</long>
<list_type>int</list_type>
<locale name="C">
<short>Position and size of the import assistant window</short>
- <long>Position and size of the import assistant window ; default is set by the window manager</long>
+ <long>Position and size of the import assistant window ; default is set by the window manager.</long>
</locale>
<default>[]</default>
</schema>
@@ -307,7 +401,7 @@ All schemes used by Nautilus can be used here.</long>
<list_type>int</list_type>
<locale name="C">
<short>Position and size of the interaction dialog at import time</short>
- <long>Position and size of the interaction dialog at import time ; default is set by the window manager</long>
+ <long>Position and size of the interaction dialog at import time ; default is set by the window manager.</long>
</locale>
<default>[]</default>
</schema>
@@ -318,7 +412,7 @@ All schemes used by Nautilus can be used here.</long>
<type>string</type>
<locale name="C">
<short>Last selected folder</short>
- <long>Last folder selected when choosing a folder from where import new actions</long>
+ <long>Last folder selected when choosing a folder from where import new actions.</long>
</locale>
<default>/tmp</default>
</schema>
@@ -425,7 +519,7 @@ All schemes used by Nautilus can be used here.</long>
<type>bool</type>
<locale name="C">
<short>Display Edit toolbar</short>
- <long>Whether to display or not the Edit toolbar in the main window</long>
+ <long>Whether to display or not the Edit toolbar in the main window.</long>
</locale>
<default>false</default>
</schema>
@@ -436,7 +530,7 @@ All schemes used by Nautilus can be used here.</long>
<type>bool</type>
<locale name="C">
<short>Display File toolbar</short>
- <long>Whether to display or not the File toolbar in the main window</long>
+ <long>Whether to display or not the File toolbar in the main window.</long>
</locale>
<default>true</default>
</schema>
@@ -447,7 +541,7 @@ All schemes used by Nautilus can be used here.</long>
<type>bool</type>
<locale name="C">
<short>Display Help toolbar</short>
- <long>Whether to display or not the Help toolbar in the main window</long>
+ <long>Whether to display or not the Help toolbar in the main window.</long>
</locale>
<default>false</default>
</schema>
@@ -458,7 +552,7 @@ All schemes used by Nautilus can be used here.</long>
<type>int</type>
<locale name="C">
<short>Main pane position</short>
- <long>Width of the main window pane ; default is set by the UI manager</long>
+ <long>Width of the main window pane ; default is set by the UI manager.</long>
</locale>
<default>100</default>
</schema>
@@ -469,7 +563,7 @@ All schemes used by Nautilus can be used here.</long>
<type>bool</type>
<locale name="C">
<short>Display Tools toolbar</short>
- <long>Whether to display or not the Tools toolbar in the main window</long>
+ <long>Whether to display or not the Tools toolbar in the main window.</long>
</locale>
<default>false</default>
</schema>
@@ -481,7 +575,7 @@ All schemes used by Nautilus can be used here.</long>
<list_type>int</list_type>
<locale name="C">
<short>Position and size of the main window</short>
- <long>Position and size of the main window ; default is set by the window manager</long>
+ <long>Position and size of the main window ; default is set by the window manager.</long>
</locale>
<default>[]</default>
</schema>
@@ -493,7 +587,7 @@ All schemes used by Nautilus can be used here.</long>
<list_type>int</list_type>
<locale name="C">
<short>Position and size of the preferences dialog</short>
- <long>Position and size of the preferences dialog ; default is set by the window manager</long>
+ <long>Position and size of the preferences dialog ; default is set by the window manager.</long>
</locale>
<default>[]</default>
</schema>
diff --git a/src/common/na-xml-names.h b/src/common/na-xml-names.h
index 5088e9d..acb2586 100644
--- a/src/common/na-xml-names.h
+++ b/src/common/na-xml-names.h
@@ -80,25 +80,50 @@ G_BEGIN_DECLS
*/
#define ACTION_LABEL_DESC_SHORT _( "The label of the menu item" )
#define ACTION_LABEL_DESC_LONG _( "The label of the menu item that will appear in the Nautilus popup " \
- "menu when the selection matches the appearance condition settings" )
+ "menu when the selection matches the appearance condition settings." )
#define ACTION_TOOLTIP_DESC_SHORT _( "The tooltip of the menu item" )
#define ACTION_TOOLTIP_DESC_LONG _( "The tooltip of the menu item that will appear in the Nautilus " \
"statusbar when the user points to the Nautilus popup menu item "\
- "with his/her mouse" )
+ "with his/her mouse." )
#define ACTION_ICON_DESC_SHORT _( "The icon of the menu item" )
#define ACTION_ICON_DESC_LONG _( "The icon of the menu item that will appear next to the label " \
"in the Nautilus popup menu when the selection matches the appearance " \
- "conditions settings" )
+ "conditions settings." )
#define ACTION_ENABLED_DESC_SHORT _( "Whether the action is enabled" )
#define ACTION_ENABLED_DESC_LONG _( "If the action is disabled, it will never appear in the Nautilus " \
- "context menu" )
+ "context menu." )
+#define ACTION_ITEMS_DESC_SHORT _( "List of subitem ids" )
+#define ACTION_ITEMS_DESC_LONG _( "Ordered list of the IDs of the subitems. This may be actions or menus " \
+ "if the item is a menu, or profiles if the item is an action.\nIf this " \
+ "list doesn't exist or is empty for an action, we load the found profiles " \
+ "in the order of the read operations." )
+#define ACTION_TYPE_DESC_SHORT _( "Type of the item" )
+#define ACTION_TYPE_DESC_LONG _( "Defines if the item is an action or a menu. Possible values are :\n" \
+ "- \"Action\",\n- \"Menu\".\nThe value is case sensitive and must " \
+ "not be localized." )
+#define ACTION_TARGET_SELECTION_DESC_SHORT _( "Targets selection" )
+#define ACTION_TARGET_SELECTION_DESC_LONG _( "Whether the action of menu targets the selection Nautilus " \
+ "menus. This is the historical behavior." )
+#define ACTION_TARGET_BACKGROUND_DESC_SHORT _( "Targets background" )
+#define ACTION_TARGET_BACKGROUND_DESC_LONG _( "Whether the action of menu targets the background Nautilus menus." )
+#define ACTION_TARGET_TOOLBAR_DESC_SHORT _( "Targets toolbar" )
+#define ACTION_TARGET_TOOLBAR_DESC_LONG _( "Whether the action is candidate to be displayed in Nautilus " \
+ "toolbar.\nNote, that as of Nautilus -2.26, menus can not be " \
+ "candidate to toolbar display." )
+#define ACTION_TOOLBAR_SAME_LABEL_DESC_SHORT _( "Whether the labels are the sames" )
+#define ACTION_TOOLBAR_SAME_LABEL_DESC_LONG _( "Whether the label displayed in the Nautilus toolbar " \
+ "besides of the icon is the same that the main item label." )
+#define ACTION_TOOLBAR_LABEL_DESC_SHORT _( "Label of the item in the toolbar" )
+#define ACTION_TOOLBAR_LABEL_DESC_LONG _( "The label displayed besides of the icon in the Nautilus " \
+ "toolbar.\nNote that actual display may depend of your " \
+ "own Gnome preferences." )
#define ACTION_PROFILE_NAME_DESC_SHORT _( "A description name of the profile" )
#define ACTION_PROFILE_NAME_DESC_LONG _( "The field is here to give the user a human readable name for a " \
- "profile in the Nact interface. If not set there will be a default " \
- "auto generated string set by default" )
+ "profile in the NACT interface. If not set there will be a default " \
+ "auto generated string set." )
#define ACTION_PATH_DESC_SHORT _( "The path of the command" )
#define ACTION_PATH_DESC_LONG _( "The path of the command to start when the user select the menu item " \
- "in the Nautilus popup menu" )
+ "in the Nautilus popup menu." )
#define ACTION_PARAMETERS_DESC_SHORT _( "The parameters of the command" )
/* too long string for iso c: 665 (max=509) */
#define ACTION_PARAMETERS_DESC_LONG _( "The parameters of the command to start when the user selects the menu " \
@@ -110,36 +135,39 @@ G_BEGIN_DECLS
"file(s)/folder(s)\n%M: space-separated list of the selected file(s)/folder(s), " \
"with their full paths\n%p: port number of the first URI\n%R: space-separated " \
"list of selected URIs\n%s: scheme of the URI\n%u: URI\n%U: username of the " \
- "URI\n%%: a percent sign" )
+ "URI\n%%: a percent sign." )
#define ACTION_BASENAMES_DESC_SHORT _( "The list of pattern to match the selected file(s)/folder(s)" )
#define ACTION_BASENAMES_DESC_LONG _( "A list of strings with joker '*' or '?' to match the name of the selected " \
"file(s)/folder(s). Each selected items must match at least one of the " \
- "filename patterns for the action to appear" )
+ "filename patterns for the action to appear. " \
+ "This only applies when targeting selection." )
#define ACTION_MATCHCASE_DESC_SHORT _( "'true' if the filename patterns have to be case sensitive, 'false' otherwise" )
#define ACTION_MATCHCASE_DESC_LONG _( "If you need to match a filename in a case-sensitive manner, set this key to " \
"'true'. If you also want, for example '*.jpg' to match 'photo.JPG', " \
- "set 'false'" )
+ "set 'false'. This only applies when targeting selection." )
#define ACTION_MIMETYPES_DESC_SHORT _( "The list of patterns to match the mimetypes of the selected file(s)" )
#define ACTION_MIMETYPES_DESC_LONG _( "A list of strings with joker '*' or '?' to match the mimetypes of the selected " \
"file(s). Each selected items must match at least one of the " \
- "mimetype patterns for the action to appear" )
+ "mimetype patterns for the action to appear. " \
+ "This only applies when targeting selection." )
#define ACTION_ISFILE_DESC_SHORT _( "'true' if the selection can have files, 'false' otherwise" )
#define ACTION_ISFILE_DESC_LONG _( "This setting is tied in with the 'isdir' setting. The valid combinations " \
"are:\n\nisfile=TRUE and isdir=FALSE: the selection may hold only files\n" \
"isfile=FALSE and isdir=TRUE: the selection may hold only folders\n" \
"isfile=TRUE and isdir=TRUE: the selection may hold both files and folders\n" \
"isfile=FALSE and isdir=FALSE: this is an invalid combination (your configuration " \
- "will never appear)" )
+ "will never appear). This only applies when targeting selection." )
#define ACTION_ISDIR_DESC_SHORT _( "'true' if the selection can have folders, 'false' otherwise" )
#define ACTION_ISDIR_DESC_LONG _( "This setting is tied in with the 'isfile' setting. The valid combinations " \
"are:\n\nisfile=TRUE and isdir=FALSE: the selection may hold only files\n" \
"isfile=FALSE and isdir=TRUE: the selection may hold only folders\n" \
"isfile=TRUE and isdir=TRUE: the selection may hold both files and folders\n" \
"isfile=FALSE and isdir=FALSE: this is an invalid combination (your configuration " \
- "will never appear)" )
+ "will never appear). This only applies when targeting selection." )
#define ACTION_MULTIPLE_DESC_SHORT _( "'true' if the selection can have several items, 'false' otherwise" )
#define ACTION_MULTIPLE_DESC_LONG _( "If you need one or more files or folders to be selected, set this " \
- "key to 'true'. If you want just one file or folder, set 'false'" )
+ "key to 'true'. If you want just one file or folder, set 'false'. " \
+ "This only applies when targeting selection." )
#define ACTION_SCHEMES_DESC_SHORT _( "The list of schemes where the selected files should be located" )
/* too long string for iso c: 510 (max=509) */
#define ACTION_SCHEMES_DESC_LONG _( "Defines the list of valid schemes to be matched against the selected " \
@@ -148,10 +176,15 @@ G_BEGIN_DECLS
"URI include:\nfile:///tmp/foo.txt\nsftp:///root test example net/tmp/foo.txt\n\n" \
"The most common schemes are:\n\n'file': local files\n'sftp': files accessed via SSH\n" \
"'ftp': files accessed via FTP\n'smb': files accessed via Samba (Windows share)\n" \
- "'dav': files accessed via WebDAV\n\nAll schemes used by Nautilus can be used here." )
+ "'dav': files accessed via WebDAV\n\nAll schemes used by Nautilus can be used here.\n" \
+ "This only applies when targeting selection." )
+#define ACTION_FOLDERS_DESC_SHORT _( "The list of URIs on which the Background item applies" )
+#define ACTION_FOLDERS_DESC_LONG _( "Defines the list of valid URIs to be matched against the current folder.\n " \
+ "This is only used when targeting background or toolbar. All folders 'under' " \
+ "the specified URI are considered valid." )
#define ACTION_VERSION_DESC_SHORT _( "The version of the configuration format" )
#define ACTION_VERSION_DESC_LONG _( "The version of the configuration format that will be used to manage " \
- "backward compatibility" )
+ "backward compatibility." )
G_END_DECLS
diff --git a/src/common/na-xml-writer.c b/src/common/na-xml-writer.c
index 8b38c14..f2ff25e 100644
--- a/src/common/na-xml-writer.c
+++ b/src/common/na-xml-writer.c
@@ -538,6 +538,12 @@ create_xml_schema( NAXMLWriter *writer, gint format, const NAObjectAction *actio
gchar *profile_dir, *profile_label, *path, *parameters;
GSList *basenames, *mimetypes, *schemes;
gboolean match, isfile, isdir, multiple;
+ gchar *type;
+ GSList *items;
+ gboolean target_selection, target_background, target_toolbar;
+ gboolean toolbar_same_label;
+ gchar *toolbar_label;
+ GSList *folders;
doc = xmlNewDoc( BAD_CAST( "1.0" ));
root_node = xmlNewNode( NULL, BAD_CAST( NACT_GCONF_SCHEMA_ROOT ));
@@ -570,6 +576,47 @@ create_xml_schema( NAXMLWriter *writer, gint format, const NAObjectAction *actio
create_schema_entry( writer, format, NULL, OBJECT_ITEM_ENABLED_ENTRY, text, doc, list_node, "bool", FALSE, ACTION_ENABLED_DESC_SHORT, ACTION_ENABLED_DESC_LONG );
g_free( text );
+ /* items */
+ items = na_object_item_rebuild_items_list( NA_OBJECT_ITEM( action ));
+ text = na_utils_gslist_to_schema( items );
+ create_schema_entry( writer, format, NULL, OBJECT_ITEM_LIST_ENTRY, text, doc, list_node, "list", FALSE, ACTION_ITEMS_DESC_SHORT, ACTION_ITEMS_DESC_LONG );
+ g_free( text );
+ na_utils_free_string_list( items );
+
+ /* type */
+ type = NA_IS_OBJECT_ACTION( action ) ? g_strdup( "Action" ) : g_strdup( "Menu" );
+ create_schema_entry( writer, format, NULL, OBJECT_ITEM_TYPE_ENTRY, type, doc, list_node, "string", FALSE, ACTION_TYPE_DESC_SHORT, ACTION_TYPE_DESC_LONG );
+ g_free( type );
+
+ /* target selection */
+ target_selection = na_object_is_target_selection( action );
+ text = na_utils_boolean_to_schema( target_selection );
+ create_schema_entry( writer, format, NULL, OBJECT_ITEM_TARGET_SELECTION_ENTRY, text, doc, list_node, "bool", FALSE, ACTION_TARGET_SELECTION_DESC_SHORT, ACTION_TARGET_SELECTION_DESC_LONG );
+ g_free( text );
+
+ /* target background */
+ target_background = na_object_is_target_background( action );
+ text = na_utils_boolean_to_schema( target_background );
+ create_schema_entry( writer, format, NULL, OBJECT_ITEM_TARGET_BACKGROUND_ENTRY, text, doc, list_node, "bool", FALSE, ACTION_TARGET_BACKGROUND_DESC_SHORT, ACTION_TARGET_BACKGROUND_DESC_LONG );
+ g_free( text );
+
+ /* target toolbar */
+ target_toolbar = na_object_is_target_toolbar( action );
+ text = na_utils_boolean_to_schema( target_toolbar );
+ create_schema_entry( writer, format, NULL, OBJECT_ITEM_TARGET_TOOLBAR_ENTRY, text, doc, list_node, "bool", FALSE, ACTION_TARGET_TOOLBAR_DESC_SHORT, ACTION_TARGET_TOOLBAR_DESC_LONG );
+ g_free( text );
+
+ /* toolbar same label */
+ toolbar_same_label = na_object_action_toolbar_use_same_label( action );
+ text = na_utils_boolean_to_schema( toolbar_same_label );
+ create_schema_entry( writer, format, NULL, OBJECT_ITEM_TOOLBAR_SAME_LABEL_ENTRY, text, doc, list_node, "bool", FALSE, ACTION_TOOLBAR_SAME_LABEL_DESC_SHORT, ACTION_TOOLBAR_SAME_LABEL_DESC_LONG );
+ g_free( text );
+
+ /* toolbar label */
+ toolbar_label = na_object_action_toolbar_get_label( action );
+ create_schema_entry( writer, format, NULL, OBJECT_ITEM_TOOLBAR_LABEL_ENTRY, toolbar_label, doc, list_node, "string", TRUE, ACTION_TOOLBAR_LABEL_DESC_SHORT, ACTION_TOOLBAR_LABEL_DESC_LONG );
+ g_free( toolbar_label );
+
profiles = na_object_get_items_list( action );
for( ip = profiles ; ip ; ip = ip->next ){
@@ -637,6 +684,13 @@ create_xml_schema( NAXMLWriter *writer, gint format, const NAObjectAction *actio
g_free( text );
na_utils_free_string_list( schemes );
+ /* folders */
+ folders = na_object_profile_get_folders( profile );
+ text = na_utils_gslist_to_schema( folders );
+ create_schema_entry( writer, format, profile_dir, ACTION_FOLDERS_ENTRY, text, doc, list_node, "list", FALSE, ACTION_FOLDERS_DESC_SHORT, ACTION_FOLDERS_DESC_LONG );
+ g_free( text );
+ na_utils_free_string_list( folders );
+
g_free( profile_dir );
}
@@ -718,6 +772,12 @@ create_xml_dump( NAXMLWriter *writer, gint format, const NAObjectAction *action
gchar *profile_label, *parameters;
GSList *basenames, *mimetypes, *schemes;
gboolean match, isfile, isdir, multiple;
+ gchar *type;
+ GSList *items;
+ gboolean target_selection, target_background, target_toolbar;
+ gboolean toolbar_same_label;
+ gchar *toolbar_label;
+ GSList *folders;
doc = xmlNewDoc( BAD_CAST( "1.0" ));
root_node = xmlNewNode( NULL, BAD_CAST( NACT_GCONF_DUMP_ROOT ));
@@ -754,6 +814,47 @@ create_xml_dump( NAXMLWriter *writer, gint format, const NAObjectAction *action
create_dump_entry( writer, format, NULL, OBJECT_ITEM_ENABLED_ENTRY, text, doc, list_node, "bool" );
g_free( text );
+ /* items */
+ items = na_object_item_rebuild_items_list( NA_OBJECT_ITEM( action ));
+ text = na_utils_gslist_to_schema( items );
+ create_dump_entry( writer, format, NULL, OBJECT_ITEM_LIST_ENTRY, text, doc, list_node, "list" );
+ g_free( text );
+ na_utils_free_string_list( items );
+
+ /* type */
+ type = NA_IS_OBJECT_ACTION( action ) ? g_strdup( "Action" ) : g_strdup( "Menu" );
+ create_dump_entry( writer, format, NULL, OBJECT_ITEM_TYPE_ENTRY, type, doc, list_node, "string" );
+ g_free( type );
+
+ /* target selection */
+ target_selection = na_object_is_target_selection( action );
+ text = na_utils_boolean_to_schema( target_selection );
+ create_dump_entry( writer, format, NULL, OBJECT_ITEM_TARGET_SELECTION_ENTRY, text, doc, list_node, "bool" );
+ g_free( text );
+
+ /* target background */
+ target_background = na_object_is_target_background( action );
+ text = na_utils_boolean_to_schema( target_background );
+ create_dump_entry( writer, format, NULL, OBJECT_ITEM_TARGET_BACKGROUND_ENTRY, text, doc, list_node, "bool" );
+ g_free( text );
+
+ /* target toolbar */
+ target_toolbar = na_object_is_target_toolbar( action );
+ text = na_utils_boolean_to_schema( target_toolbar );
+ create_dump_entry( writer, format, NULL, OBJECT_ITEM_TARGET_TOOLBAR_ENTRY, text, doc, list_node, "bool" );
+ g_free( text );
+
+ /* toolbar same label */
+ toolbar_same_label = na_object_action_toolbar_use_same_label( action );
+ text = na_utils_boolean_to_schema( toolbar_same_label );
+ create_dump_entry( writer, format, NULL, OBJECT_ITEM_TOOLBAR_SAME_LABEL_ENTRY, text, doc, list_node, "bool" );
+ g_free( text );
+
+ /* toolbar label */
+ toolbar_label = na_object_action_toolbar_get_label( action );
+ create_dump_entry( writer, format, NULL, OBJECT_ITEM_TOOLBAR_LABEL_ENTRY, toolbar_label, doc, list_node, "string" );
+ g_free( toolbar_label );
+
profiles = na_object_get_items_list( action );
for( ip = profiles ; ip ; ip = ip->next ){
@@ -821,6 +922,13 @@ create_xml_dump( NAXMLWriter *writer, gint format, const NAObjectAction *action
g_free( text );
na_utils_free_string_list( schemes );
+ /* folders */
+ folders = na_object_profile_get_folders( profile );
+ text = na_utils_gslist_to_schema( folders );
+ create_dump_entry( writer, format, profile_dir, ACTION_FOLDERS_ENTRY, text, doc, list_node, "list" );
+ g_free( text );
+ na_utils_free_string_list( folders );
+
g_free( profile_dir );
}
@@ -885,6 +993,13 @@ create_gconf_schema( NAXMLWriter *writer )
create_gconf_schema_entry( writer, OBJECT_ITEM_TOOLTIP_ENTRY , doc, list_node, "string", ACTION_TOOLTIP_DESC_SHORT , ACTION_TOOLTIP_DESC_LONG , "", TRUE );
create_gconf_schema_entry( writer, OBJECT_ITEM_ICON_ENTRY , doc, list_node, "string", ACTION_ICON_DESC_SHORT , ACTION_ICON_DESC_LONG , "", FALSE );
create_gconf_schema_entry( writer, OBJECT_ITEM_ENABLED_ENTRY , doc, list_node, "bool" , ACTION_ENABLED_DESC_SHORT , ACTION_ENABLED_DESC_LONG , "true", FALSE );
+ create_gconf_schema_entry( writer, OBJECT_ITEM_LIST_ENTRY , doc, list_node, "list" , ACTION_ITEMS_DESC_SHORT , ACTION_ITEMS_DESC_LONG , "[]", FALSE );
+ create_gconf_schema_entry( writer, OBJECT_ITEM_TYPE_ENTRY , doc, list_node, "string", ACTION_TYPE_DESC_SHORT , ACTION_TYPE_DESC_LONG , "Action", FALSE );
+ create_gconf_schema_entry( writer, OBJECT_ITEM_TARGET_SELECTION_ENTRY , doc, list_node, "bool", ACTION_TARGET_SELECTION_DESC_SHORT , ACTION_TARGET_SELECTION_DESC_LONG , "true", FALSE );
+ create_gconf_schema_entry( writer, OBJECT_ITEM_TARGET_BACKGROUND_ENTRY , doc, list_node, "bool", ACTION_TARGET_BACKGROUND_DESC_SHORT , ACTION_TARGET_BACKGROUND_DESC_LONG , "false", FALSE );
+ create_gconf_schema_entry( writer, OBJECT_ITEM_TARGET_TOOLBAR_ENTRY , doc, list_node, "bool", ACTION_TARGET_TOOLBAR_DESC_SHORT , ACTION_TARGET_TOOLBAR_DESC_LONG , "false", FALSE );
+ create_gconf_schema_entry( writer, OBJECT_ITEM_TOOLBAR_SAME_LABEL_ENTRY, doc, list_node, "bool", ACTION_TOOLBAR_SAME_LABEL_DESC_SHORT, ACTION_TOOLBAR_SAME_LABEL_DESC_LONG, "false", FALSE );
+ create_gconf_schema_entry( writer, OBJECT_ITEM_TOOLBAR_LABEL_ENTRY , doc, list_node, "string", ACTION_TOOLBAR_LABEL_DESC_SHORT , ACTION_TOOLBAR_LABEL_DESC_LONG , "", TRUE );
create_gconf_schema_entry( writer, ACTION_PROFILE_LABEL_ENTRY , doc, list_node, "string", ACTION_PROFILE_NAME_DESC_SHORT, ACTION_PROFILE_NAME_DESC_LONG, NA_OBJECT_PROFILE_DEFAULT_LABEL, TRUE );
create_gconf_schema_entry( writer, ACTION_PATH_ENTRY , doc, list_node, "string", ACTION_PATH_DESC_SHORT , ACTION_PATH_DESC_LONG , "", FALSE );
create_gconf_schema_entry( writer, ACTION_PARAMETERS_ENTRY , doc, list_node, "string", ACTION_PARAMETERS_DESC_SHORT , ACTION_PARAMETERS_DESC_LONG , "", FALSE );
@@ -895,6 +1010,7 @@ create_gconf_schema( NAXMLWriter *writer )
create_gconf_schema_entry( writer, ACTION_ISDIR_ENTRY , doc, list_node, "bool" , ACTION_ISDIR_DESC_SHORT , ACTION_ISDIR_DESC_LONG , "false", FALSE );
create_gconf_schema_entry( writer, ACTION_MULTIPLE_ENTRY , doc, list_node, "bool" , ACTION_MULTIPLE_DESC_SHORT , ACTION_MULTIPLE_DESC_LONG , "false", FALSE );
create_gconf_schema_entry( writer, ACTION_SCHEMES_ENTRY , doc, list_node, "list" , ACTION_SCHEMES_DESC_SHORT , ACTION_SCHEMES_DESC_LONG , "[file]", FALSE );
+ create_gconf_schema_entry( writer, ACTION_FOLDERS_ENTRY , doc, list_node, "list" , ACTION_FOLDERS_DESC_SHORT , ACTION_FOLDERS_DESC_LONG , "[]", FALSE );
return( doc );
}
diff --git a/src/nact/Makefile.am b/src/nact/Makefile.am
index 61ea31e..05ef449 100644
--- a/src/nact/Makefile.am
+++ b/src/nact/Makefile.am
@@ -78,6 +78,8 @@ nautilus_actions_config_tool_SOURCES = \
nact-iaction-tab.h \
nact-iadvanced-tab.c \
nact-iadvanced-tab.h \
+ nact-ibackground-tab.c \
+ nact-ibackground-tab.h \
nact-icommand-tab.c \
nact-icommand-tab.h \
nact-iconditions-tab.c \
@@ -87,6 +89,7 @@ nautilus_actions_config_tool_SOURCES = \
nact-main-menubar.h \
nact-main-statusbar.c \
nact-main-statusbar.h \
+ nact-main-tab.c \
nact-main-tab.h \
nact-main-window.c \
nact-main-window.h \
diff --git a/src/nact/nact-assistant-export.c b/src/nact/nact-assistant-export.c
index 5a00f3e..e5d7a92 100644
--- a/src/nact/nact-assistant-export.c
+++ b/src/nact/nact-assistant-export.c
@@ -803,7 +803,7 @@ assistant_apply( BaseAssistant *wnd, GtkAssistant *assistant )
str = g_new0( ExportStruct, 1 );
window->private->results = g_list_append( window->private->results, str );
- str->action = NA_OBJECT_ACTION( ia->data );
+ str->action = NA_OBJECT_ACTION( na_iduplicable_get_origin( NA_IDUPLICABLE( ia->data )));
str->format = na_iprefs_get_export_format( NA_IPREFS( pivot ), IPREFS_EXPORT_FORMAT );
if( str->format == IPREFS_EXPORT_FORMAT_ASK ){
diff --git a/src/nact/nact-iaction-tab.c b/src/nact/nact-iaction-tab.c
index e09268d..9c32da3 100644
--- a/src/nact/nact-iaction-tab.c
+++ b/src/nact/nact-iaction-tab.c
@@ -71,20 +71,28 @@ static void interface_base_finalize( NactIActionTabInterface *klass );
static void on_iactions_list_column_edited( NactIActionTab *instance, NAObject *object, gchar *text, gint column );
static void on_tab_updatable_selection_changed( NactIActionTab *instance, gint count_selected );
+
static void check_for_label( NactIActionTab *instance, GtkEntry *entry, const gchar *label );
+static void on_label_changed( GtkEntry *entry, NactIActionTab *instance );
+static void set_label_label( NactIActionTab *instance, const gchar *color );
+
+static void on_tooltip_changed( GtkEntry *entry, NactIActionTab *instance );
+
static GtkTreeModel *create_stock_icon_model( void );
static void display_icon( NactIActionTab *instance, GtkWidget *image, gboolean display );
-static GtkButton *get_enabled_button( NactIActionTab *instance );
static void icon_combo_list_fill( GtkComboBoxEntry* combo );
-static void on_enabled_toggled( GtkToggleButton *button, NactIActionTab *instance );
static void on_icon_browse( GtkButton *button, NactIActionTab *instance );
static void on_icon_changed( GtkEntry *entry, NactIActionTab *instance );
-static void on_label_changed( GtkEntry *entry, NactIActionTab *instance );
-static void on_tooltip_changed( GtkEntry *entry, NactIActionTab *instance );
-static void set_label_label( NactIActionTab *instance, const gchar *color );
static gint sort_stock_ids( gconstpointer a, gconstpointer b );
static gchar *strip_underscore( const gchar *text );
+static void on_target_selection_toggled( GtkToggleButton *button, NactIActionTab *instance );
+static void on_target_background_toggled( GtkToggleButton *button, NactIActionTab *instance );
+static void on_target_toolbar_toggled( GtkToggleButton *button, NactIActionTab *instance );
+
+static GtkButton *get_enabled_button( NactIActionTab *instance );
+static void on_enabled_toggled( GtkToggleButton *button, NactIActionTab *instance );
+
GType
nact_iaction_tab_get_type( void )
{
@@ -228,6 +236,27 @@ nact_iaction_tab_runtime_init_toplevel( NactIActionTab *instance )
IACTIONS_LIST_SIGNAL_COLUMN_EDITED,
G_CALLBACK( on_iactions_list_column_edited ),
instance );
+
+ button = base_window_get_widget( BASE_WINDOW( instance ), "ActionTargetSelectionButton" );
+ g_signal_connect(
+ G_OBJECT( button ),
+ "toggled",
+ G_CALLBACK( on_target_selection_toggled ),
+ instance );
+
+ button = base_window_get_widget( BASE_WINDOW( instance ), "ActionTargetBackgroundButton" );
+ g_signal_connect(
+ G_OBJECT( button ),
+ "toggled",
+ G_CALLBACK( on_target_background_toggled ),
+ instance );
+
+ button = base_window_get_widget( BASE_WINDOW( instance ), "ActionTargetToolbarButton" );
+ g_signal_connect(
+ G_OBJECT( button ),
+ "toggled",
+ G_CALLBACK( on_target_toolbar_toggled ),
+ instance );
}
}
@@ -303,11 +332,14 @@ on_tab_updatable_selection_changed( NactIActionTab *instance, gint count_selecte
{
static const gchar *thisfn = "nact_iaction_tab_on_tab_updatable_selection_changed";
NAObjectItem *item;
- GtkWidget *label_widget, *tooltip_widget, *icon_widget, *button, *group_title;
+ GtkWidget *label_widget, *tooltip_widget, *icon_widget, *title_widget;
gchar *label, *tooltip, *icon;
GtkButton *enabled_button;
gboolean enabled_item;
- gboolean enabled_tab;
+ gboolean enable_tab;
+ gboolean target_background_active;
+ gboolean target_toolbar_active;
+ GtkToggleButton *toggle;
g_debug( "%s: instance=%p, count_selected=%d", thisfn, ( void * ) instance, count_selected );
g_return_if_fail( BASE_IS_WINDOW( instance ));
@@ -322,12 +354,21 @@ on_tab_updatable_selection_changed( NactIActionTab *instance, gint count_selecte
g_return_if_fail( !item || NA_IS_OBJECT_ITEM( item ));
- enabled_tab = ( count_selected == 1 );
+ enable_tab = ( count_selected == 1 );
+ if( item && !enable_tab ){
+ g_warning( "%s:item=%p (%s), but count_selected=%d",
+ thisfn, ( void * ) item, G_OBJECT_TYPE_NAME( item ), count_selected );
+ }
+ nact_main_tab_enable_page( NACT_MAIN_WINDOW( instance ), TAB_ACTION, enable_tab );
+
+ label_widget = base_window_get_widget( BASE_WINDOW( instance ), "ActionItemID" );
+ label = item ? na_object_get_id( item ) : g_strdup( "" );
+ gtk_label_set_text( GTK_LABEL( label_widget ), label );
+ g_free( label );
label_widget = base_window_get_widget( BASE_WINDOW( instance ), "ActionLabelEntry" );
label = item ? na_object_get_label( item ) : g_strdup( "" );
gtk_entry_set_text( GTK_ENTRY( label_widget ), label );
- gtk_widget_set_sensitive( label_widget, enabled_tab );
if( item ){
check_for_label( instance, GTK_ENTRY( label_widget ), label );
}
@@ -336,29 +377,45 @@ on_tab_updatable_selection_changed( NactIActionTab *instance, gint count_selecte
tooltip_widget = base_window_get_widget( BASE_WINDOW( instance ), "ActionTooltipEntry" );
tooltip = item ? na_object_get_tooltip( item ) : g_strdup( "" );
gtk_entry_set_text( GTK_ENTRY( tooltip_widget ), tooltip );
- gtk_widget_set_sensitive( tooltip_widget, enabled_tab );
g_free( tooltip );
icon_widget = base_window_get_widget( BASE_WINDOW( instance ), "ActionIconComboBoxEntry" );
icon = item ? na_object_get_icon( item ) : g_strdup( "" );
gtk_entry_set_text( GTK_ENTRY( GTK_BIN( icon_widget )->child ), icon );
- gtk_widget_set_sensitive( icon_widget, enabled_tab );
g_free( icon );
- button = base_window_get_widget( BASE_WINDOW( instance ), "ActionIconBrowseButton" );
- gtk_widget_set_sensitive( button, enabled_tab );
+ title_widget = base_window_get_widget( BASE_WINDOW( instance ), "ActionTargetsTitle" );
+ if( item && NA_IS_OBJECT_MENU( item )){
+ gtk_label_set_markup( GTK_LABEL( title_widget ), _( "<b>Menu targets</b>" ));
+ } else {
+ gtk_label_set_markup( GTK_LABEL( title_widget ), _( "<b>Action targets</b>" ));
+ }
+
+ toggle = GTK_TOGGLE_BUTTON( base_window_get_widget( BASE_WINDOW( instance ), "ActionTargetSelectionButton" ));
+ gtk_toggle_button_set_active( toggle, item ? na_object_is_target_selection( item ) : FALSE );
- group_title = base_window_get_widget( BASE_WINDOW( instance ), "ActionPropertiesGroupTitle" );
- if( NA_IS_OBJECT_MENU( item )){
- gtk_label_set_markup( GTK_LABEL( group_title ), _( "<b>Menu properties</b>" ));
+ toggle = GTK_TOGGLE_BUTTON( base_window_get_widget( BASE_WINDOW( instance ), "ActionTargetBackgroundButton" ));
+ target_background_active = ( item ? na_object_is_target_background( item ) : FALSE );
+ gtk_toggle_button_set_active( toggle, target_background_active );
+
+ toggle = GTK_TOGGLE_BUTTON( base_window_get_widget( BASE_WINDOW( instance ), "ActionTargetToolbarButton" ));
+ target_toolbar_active = ( item ? na_object_is_target_toolbar( item ) : FALSE );
+ if( target_toolbar_active && item && NA_IS_OBJECT_MENU( item )){
+ g_warning( "%s: targeting toolbar is irrelevant for a menu", thisfn );
+ }
+ gtk_toggle_button_set_active( toggle, target_toolbar_active );
+ gtk_widget_set_sensitive( GTK_WIDGET( toggle ), item && NA_IS_OBJECT_ACTION( item ));
+
+ title_widget = base_window_get_widget( BASE_WINDOW( instance ), "ActionPropertiesTitle" );
+ if( item && NA_IS_OBJECT_MENU( item )){
+ gtk_label_set_markup( GTK_LABEL( title_widget ), _( "<b>Menu properties</b>" ));
} else {
- gtk_label_set_markup( GTK_LABEL( group_title ), _( "<b>Action properties</b>" ));
+ gtk_label_set_markup( GTK_LABEL( title_widget ), _( "<b>Action properties</b>" ));
}
enabled_button = get_enabled_button( instance );
enabled_item = item ? na_object_is_enabled( NA_OBJECT_ITEM( item )) : FALSE;
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( enabled_button ), enabled_item );
- gtk_widget_set_sensitive( GTK_WIDGET( enabled_button ), enabled_tab );
/* TODO: manage read-only flag */
}
@@ -398,6 +455,66 @@ check_for_label( NactIActionTab *instance, GtkEntry *entry, const gchar *label )
}
}
+static void
+on_label_changed( GtkEntry *entry, NactIActionTab *instance )
+{
+ NAObjectItem *edited;
+ const gchar *label;
+ gboolean target_toolbar;
+ gboolean toolbar_same_label;
+
+ g_object_get(
+ G_OBJECT( instance ),
+ TAB_UPDATABLE_PROP_EDITED_ACTION, &edited,
+ NULL );
+
+ if( edited ){
+ label = gtk_entry_get_text( entry );
+ na_object_set_label( edited, label );
+ check_for_label( instance, entry, label );
+
+ if( NA_IS_OBJECT_ACTION( edited )){
+ target_toolbar = na_object_is_target_toolbar( edited );
+ if( target_toolbar ){
+ toolbar_same_label = na_object_action_toolbar_use_same_label( NA_OBJECT_ACTION( edited ));
+ if( toolbar_same_label ){
+ na_object_action_toolbar_set_label( NA_OBJECT_ACTION( edited ), label );
+ }
+ }
+ }
+
+ g_signal_emit_by_name( G_OBJECT( instance ), TAB_UPDATABLE_SIGNAL_ITEM_UPDATED, edited, TRUE );
+ }
+}
+
+static void
+set_label_label( NactIActionTab *instance, const gchar *color )
+{
+ GtkWidget *label;
+ gchar *text;
+
+ label = base_window_get_widget( BASE_WINDOW( instance ), "ActionLabelLabel" );
+ /* i18n: label in front of the GtkEntry where user enters the action label */
+ text = g_markup_printf_escaped( "<span color=\"%s\">%s</span>", color, _( "_Label :" ));
+ gtk_label_set_markup_with_mnemonic( GTK_LABEL( label ), text );
+}
+
+static void
+on_tooltip_changed( GtkEntry *entry, NactIActionTab *instance )
+{
+ NAObjectItem *edited;
+
+ g_object_get(
+ G_OBJECT( instance ),
+ TAB_UPDATABLE_PROP_EDITED_ACTION, &edited,
+ NULL );
+
+ if( edited ){
+ na_object_item_set_tooltip( edited, gtk_entry_get_text( entry ));
+ g_signal_emit_by_name( G_OBJECT( instance ), TAB_UPDATABLE_SIGNAL_ITEM_UPDATED, edited, FALSE );
+ }
+}
+
static GtkTreeModel *
create_stock_icon_model( void )
{
@@ -454,12 +571,6 @@ display_icon( NactIActionTab *instance, GtkWidget *image, gboolean show )
}
}
-static GtkButton *
-get_enabled_button( NactIActionTab *instance )
-{
- return( GTK_BUTTON( base_window_get_widget( BASE_WINDOW( instance ), "ActionEnabledButton" )));
-}
-
static void
icon_combo_list_fill( GtkComboBoxEntry* combo )
{
@@ -483,53 +594,6 @@ icon_combo_list_fill( GtkComboBoxEntry* combo )
}
static void
-on_enabled_toggled( GtkToggleButton *button, NactIActionTab *instance )
-{
- NAObjectItem *edited;
- gboolean enabled;
-
- g_object_get(
- G_OBJECT( instance ),
- TAB_UPDATABLE_PROP_EDITED_ACTION, &edited,
- NULL );
-
- if( edited && NA_IS_OBJECT_ACTION( edited )){
- enabled = gtk_toggle_button_get_active( button );
- na_object_item_set_enabled( edited, enabled );
- g_signal_emit_by_name( G_OBJECT( instance ), TAB_UPDATABLE_SIGNAL_ITEM_UPDATED, edited, FALSE );
- }
-}
-
-static void
-on_label_changed( GtkEntry *entry, NactIActionTab *instance )
-{
- NAObjectItem *edited;
- const gchar *label;
-
- g_object_get(
- G_OBJECT( instance ),
- TAB_UPDATABLE_PROP_EDITED_ACTION, &edited,
- NULL );
-
- if( edited ){
- label = gtk_entry_get_text( entry );
- na_object_set_label( NA_OBJECT( edited ), label );
- g_signal_emit_by_name( G_OBJECT( instance ), TAB_UPDATABLE_SIGNAL_ITEM_UPDATED, edited, TRUE );
- check_for_label( instance, entry, label );
- }
-
- /* 2009-07-20: about 900-1200 usec for ten loops */
- /*int i;
- GTimeVal begin, end;
- g_get_current_time( &begin );
- for( i=0 ; i<10 ; ++i ){
- v_field_modified( dialog );
- }
- g_get_current_time( &end );
- g_debug( "on_label_changed: %ld usec", ( 1000000 * ( end.tv_sec - begin.tv_sec )) + end.tv_usec - begin.tv_usec );*/
-}
-
-static void
on_icon_browse( GtkButton *button, NactIActionTab *instance )
{
GtkWidget *dialog;
@@ -586,34 +650,6 @@ on_icon_changed( GtkEntry *icon_entry, NactIActionTab *instance )
}
}
-static void
-on_tooltip_changed( GtkEntry *entry, NactIActionTab *instance )
-{
- NAObjectItem *edited;
-
- g_object_get(
- G_OBJECT( instance ),
- TAB_UPDATABLE_PROP_EDITED_ACTION, &edited,
- NULL );
-
- if( edited ){
- na_object_item_set_tooltip( edited, gtk_entry_get_text( entry ));
- g_signal_emit_by_name( G_OBJECT( instance ), TAB_UPDATABLE_SIGNAL_ITEM_UPDATED, edited, FALSE );
- }
-}
-
-static void
-set_label_label( NactIActionTab *instance, const gchar *color )
-{
- GtkWidget *label;
- gchar *text;
-
- label = base_window_get_widget( BASE_WINDOW( instance ), "ActionLabelLabel" );
- /* i18n: label in front of the GtkEntry where user enters the action label */
- text = g_markup_printf_escaped( "<span color=\"%s\">%s</span>", color, _( "_Label :" ));
- gtk_label_set_markup_with_mnemonic( GTK_LABEL( label ), text );
-}
-
static gint
sort_stock_ids( gconstpointer a, gconstpointer b )
{
@@ -665,3 +701,100 @@ strip_underscore( const gchar *text )
return( result );
}
+
+static void
+on_target_selection_toggled( GtkToggleButton *button, NactIActionTab *instance )
+{
+ static const gchar *thisfn = "nact_iaction_tab_on_target_selection_toggled";
+ NAObjectItem *item;
+ gboolean is_target;
+
+ g_debug( "%s: button=%p, instance=%p", thisfn, ( void * ) button, ( void * ) instance );
+
+ g_object_get(
+ G_OBJECT( instance ),
+ TAB_UPDATABLE_PROP_EDITED_ACTION, &item,
+ NULL );
+
+ if( item ){
+ is_target = gtk_toggle_button_get_active( button );
+ na_object_set_target_selection( item, is_target );
+
+ g_signal_emit_by_name( G_OBJECT( instance ), TAB_UPDATABLE_SIGNAL_ENABLE_TAB, item );
+ g_signal_emit_by_name( G_OBJECT( instance ), TAB_UPDATABLE_SIGNAL_ITEM_UPDATED, item, FALSE );
+ }
+}
+
+static void
+on_target_background_toggled( GtkToggleButton *button, NactIActionTab *instance )
+{
+ static const gchar *thisfn = "nact_iaction_tab_on_target_background_toggled";
+ NAObjectItem *item;
+ gboolean is_target;
+ GtkWidget *toolbar;
+
+ g_debug( "%s: button=%p, instance=%p", thisfn, ( void * ) button, ( void * ) instance );
+
+ g_object_get(
+ G_OBJECT( instance ),
+ TAB_UPDATABLE_PROP_EDITED_ACTION, &item,
+ NULL );
+
+ if( item ){
+ is_target = gtk_toggle_button_get_active( button );
+ na_object_set_target_background( item, is_target );
+
+ toolbar = base_window_get_widget( BASE_WINDOW( instance ), "ActionTargetToolbarButton" );
+ gtk_widget_set_sensitive( toolbar, is_target && NA_IS_OBJECT_ACTION( item ));
+
+ g_signal_emit_by_name( G_OBJECT( instance ), TAB_UPDATABLE_SIGNAL_ENABLE_TAB, item );
+ g_signal_emit_by_name( G_OBJECT( instance ), TAB_UPDATABLE_SIGNAL_ITEM_UPDATED, item, FALSE );
+ }
+}
+
+static void
+on_target_toolbar_toggled( GtkToggleButton *button, NactIActionTab *instance )
+{
+ static const gchar *thisfn = "nact_iaction_tab_on_target_toolbar_toggled";
+ NAObjectItem *item;
+ gboolean is_target;
+
+ g_debug( "%s: button=%p, instance=%p", thisfn, ( void * ) button, ( void * ) instance );
+
+ g_object_get(
+ G_OBJECT( instance ),
+ TAB_UPDATABLE_PROP_EDITED_ACTION, &item,
+ NULL );
+
+ if( item ){
+ is_target = gtk_toggle_button_get_active( button );
+ na_object_set_target_toolbar( item, is_target );
+
+ g_signal_emit_by_name( G_OBJECT( instance ), TAB_UPDATABLE_SIGNAL_ENABLE_TAB, item );
+ g_signal_emit_by_name( G_OBJECT( instance ), TAB_UPDATABLE_SIGNAL_ITEM_UPDATED, item, FALSE );
+ }
+}
+
+static GtkButton *
+get_enabled_button( NactIActionTab *instance )
+{
+ return( GTK_BUTTON( base_window_get_widget( BASE_WINDOW( instance ), "ActionEnabledButton" )));
+}
+
+static void
+on_enabled_toggled( GtkToggleButton *button, NactIActionTab *instance )
+{
+ NAObjectItem *edited;
+ gboolean enabled;
+
+ g_object_get(
+ G_OBJECT( instance ),
+ TAB_UPDATABLE_PROP_EDITED_ACTION, &edited,
+ NULL );
+
+ if( edited && NA_IS_OBJECT_ITEM( edited )){
+ enabled = gtk_toggle_button_get_active( button );
+ na_object_item_set_enabled( edited, enabled );
+ g_signal_emit_by_name( G_OBJECT( instance ), TAB_UPDATABLE_SIGNAL_ITEM_UPDATED, edited, FALSE );
+ }
+}
diff --git a/src/nact/nact-iadvanced-tab.c b/src/nact/nact-iadvanced-tab.c
index 9138ffc..eb5a6ca 100644
--- a/src/nact/nact-iadvanced-tab.c
+++ b/src/nact/nact-iadvanced-tab.c
@@ -68,7 +68,11 @@ static void interface_base_finalize( NactIAdvancedTabInterface *klass )
static void initial_load_create_schemes_selection_list( NactIAdvancedTab *instance );
static void runtime_init_connect_signals( NactIAdvancedTab *instance, GtkTreeView *listview );
static void runtime_init_setup_values( NactIAdvancedTab *instance, GtkTreeView *listview );
+
static void on_tab_updatable_selection_changed( NactIAdvancedTab *instance, gint count_selected );
+static void on_tab_updatable_enable_tab( NactIAdvancedTab *instance, NAObjectItem *item );
+static gboolean tab_set_sensitive( NactIAdvancedTab *instance );
+
static gboolean get_action_schemes_list( GtkTreeModel* scheme_model, GtkTreePath *path, GtkTreeIter* iter, GSList **schemes_list );
static GtkButton *get_add_button( NactIAdvancedTab *instance );
static GtkButton *get_button( NactIAdvancedTab *instance, const gchar *name );
@@ -299,6 +303,12 @@ runtime_init_connect_signals( NactIAdvancedTab *instance, GtkTreeView *listview
TAB_UPDATABLE_SIGNAL_SELECTION_CHANGED,
G_CALLBACK( on_tab_updatable_selection_changed ),
instance );
+
+ g_signal_connect(
+ G_OBJECT( instance ),
+ TAB_UPDATABLE_SIGNAL_ENABLE_TAB,
+ G_CALLBACK( on_tab_updatable_enable_tab ),
+ instance );
}
}
@@ -385,11 +395,10 @@ static void
on_tab_updatable_selection_changed( NactIAdvancedTab *instance, gint count_selected )
{
static const gchar *thisfn = "nact_iadvanced_tab_on_tab_updatable_selection_changed";
- NAObjectProfile *profile = NULL;
- GtkTreeModel *scheme_model;
+ NAObjectProfile *profile;
+ gboolean enable_tab;
GSList *schemes;
- GtkTreeView *listview;
- GtkButton *add, *remove;
+ GtkTreeModel *scheme_model;
g_debug( "%s: instance=%p, count_selected=%d", thisfn, ( void * ) instance, count_selected );
g_return_if_fail( NACT_IS_IADVANCED_TAB( instance ));
@@ -404,22 +413,48 @@ on_tab_updatable_selection_changed( NactIAdvancedTab *instance, gint count_selec
TAB_UPDATABLE_PROP_EDITED_PROFILE, &profile,
NULL );
- if( profile ){
+ enable_tab = tab_set_sensitive( instance );
+
+ if( enable_tab ){
schemes = na_object_profile_get_schemes( profile );
g_slist_foreach( schemes, ( GFunc ) set_action_schemes, scheme_model );
}
+ }
+}
- listview = get_schemes_tree_view( instance );
- gtk_widget_set_sensitive( GTK_WIDGET( listview ), profile != NULL );
+static void
+on_tab_updatable_enable_tab( NactIAdvancedTab *instance, NAObjectItem *item )
+{
+ static const gchar *thisfn = "nact_iadvanced_tab_on_tab_updatable_enable_tab";
+
+ if( st_initialized && !st_finalized ){
- add = get_add_button( instance );
- gtk_widget_set_sensitive( GTK_WIDGET( add ), profile != NULL );
+ g_debug( "%s: instance=%p, item=%p", thisfn, ( void * ) instance, ( void * ) item );
+ g_return_if_fail( NACT_IS_IADVANCED_TAB( instance ));
- remove = get_remove_button( instance );
- gtk_widget_set_sensitive( GTK_WIDGET( remove ), profile != NULL );
+ tab_set_sensitive( instance );
}
}
+static gboolean
+tab_set_sensitive( NactIAdvancedTab *instance )
+{
+ NAObjectItem *item;
+ NAObjectProfile *profile;
+ gboolean enable_tab;
+
+ g_object_get(
+ G_OBJECT( instance ),
+ TAB_UPDATABLE_PROP_EDITED_ACTION, &item,
+ TAB_UPDATABLE_PROP_EDITED_PROFILE, &profile,
+ NULL );
+
+ enable_tab = ( profile != NULL && na_object_is_target_selection( item ));
+ nact_main_tab_enable_page( NACT_MAIN_WINDOW( instance ), TAB_ADVANCED, enable_tab );
+
+ return( enable_tab );
+}
+
/*
* CommandExampleLabel is updated each time a field is modified
* And at each time, we need the list of selected schemes
diff --git a/src/nact/nact-ibackground-tab.c b/src/nact/nact-ibackground-tab.c
new file mode 100644
index 0000000..16beb04
--- /dev/null
+++ b/src/nact/nact-ibackground-tab.c
@@ -0,0 +1,343 @@
+/*
+ * Nautilus Actions
+ * A Nautilus extension which offers configurable context menu actions.
+ *
+ * Copyright (C) 2005 The GNOME Foundation
+ * Copyright (C) 2006, 2007, 2008 Frederic Ruaudel and others (see AUTHORS)
+ * Copyright (C) 2009 Pierre Wieser and others (see AUTHORS)
+ *
+ * This Program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this Library; see the file COPYING. If not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place,
+ * Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Authors:
+ * Frederic Ruaudel <grumz grumz net>
+ * Rodrigo Moya <rodrigo gnome-db org>
+ * Pierre Wieser <pwieser trychlos org>
+ * ... and many others (see AUTHORS)
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n.h>
+#include <string.h>
+
+#include <common/na-object-api.h>
+#include <common/na-utils.h>
+
+#include "base-iprefs.h"
+#include "base-window.h"
+#include "nact-main-tab.h"
+#include "nact-ibackground-tab.h"
+
+/* private interface data
+ */
+struct NactIBackgroundTabInterfacePrivate {
+ void *empty; /* so that gcc -pedantic is happy */
+};
+
+static gboolean st_initialized = FALSE;
+static gboolean st_finalized = FALSE;
+
+static GType register_type( void );
+static void interface_base_init( NactIBackgroundTabInterface *klass );
+static void interface_base_finalize( NactIBackgroundTabInterface *klass );
+
+static void on_tab_updatable_selection_changed( NactIBackgroundTab *instance, gint count_selected );
+static void on_tab_updatable_enable_tab( NactIBackgroundTab *instance, NAObjectItem *item );
+static gboolean tab_set_sensitive( NactIBackgroundTab *instance );
+
+static void on_toolbar_same_label_toggled( GtkToggleButton *button, NactIBackgroundTab *instance );
+
+static void on_toolbar_label_changed( GtkEntry *entry, NactIBackgroundTab *instance );
+
+GType
+nact_ibackground_tab_get_type( void )
+{
+ static GType iface_type = 0;
+
+ if( !iface_type ){
+ iface_type = register_type();
+ }
+
+ return( iface_type );
+}
+
+static GType
+register_type( void )
+{
+ static const gchar *thisfn = "nact_ibackground_tab_register_type";
+ GType type;
+
+ static const GTypeInfo info = {
+ sizeof( NactIBackgroundTabInterface ),
+ ( GBaseInitFunc ) interface_base_init,
+ ( GBaseFinalizeFunc ) interface_base_finalize,
+ NULL,
+ NULL,
+ NULL,
+ 0,
+ 0,
+ NULL
+ };
+
+ g_debug( "%s", thisfn );
+
+ type = g_type_register_static( G_TYPE_INTERFACE, "NactIBackgroundTab", &info, 0 );
+
+ g_type_interface_add_prerequisite( type, BASE_WINDOW_TYPE );
+
+ return( type );
+}
+
+static void
+interface_base_init( NactIBackgroundTabInterface *klass )
+{
+ static const gchar *thisfn = "nact_ibackground_tab_interface_base_init";
+
+ if( !st_initialized ){
+ g_debug( "%s: klass=%p", thisfn, ( void * ) klass );
+
+ klass->private = g_new0( NactIBackgroundTabInterfacePrivate, 1 );
+
+ st_initialized = TRUE;
+ }
+}
+
+static void
+interface_base_finalize( NactIBackgroundTabInterface *klass )
+{
+ static const gchar *thisfn = "nact_ibackground_tab_interface_base_finalize";
+
+ if( !st_finalized ){
+ g_debug( "%s: klass=%p", thisfn, ( void * ) klass );
+
+ g_free( klass->private );
+
+ st_finalized = TRUE;
+ }
+}
+
+void
+nact_ibackground_tab_initial_load_toplevel( NactIBackgroundTab *instance )
+{
+ static const gchar *thisfn = "nact_ibackground_tab_initial_load_toplevel";
+
+ g_debug( "%s: instance=%p", thisfn, ( void * ) instance );
+ g_return_if_fail( NACT_IS_IBACKGROUND_TAB( instance ));
+
+ if( st_initialized && !st_finalized ){
+ }
+}
+
+void
+nact_ibackground_tab_runtime_init_toplevel( NactIBackgroundTab *instance )
+{
+ static const gchar *thisfn = "nact_ibackground_tab_runtime_init_toplevel";
+ GtkWidget *label_widget;
+ GtkWidget *toolbar_same_label_button;
+
+ g_debug( "%s: instance=%p", thisfn, ( void * ) instance );
+ g_return_if_fail( NACT_IS_IBACKGROUND_TAB( instance ));
+
+ if( st_initialized && !st_finalized ){
+
+ g_signal_connect(
+ G_OBJECT( instance ),
+ TAB_UPDATABLE_SIGNAL_SELECTION_CHANGED,
+ G_CALLBACK( on_tab_updatable_selection_changed ),
+ instance );
+
+ g_signal_connect(
+ G_OBJECT( instance ),
+ TAB_UPDATABLE_SIGNAL_ENABLE_TAB,
+ G_CALLBACK( on_tab_updatable_enable_tab ),
+ instance );
+
+ toolbar_same_label_button = base_window_get_widget( BASE_WINDOW( instance ), "ToolbarSameLabelButton" );
+ g_signal_connect(
+ G_OBJECT( toolbar_same_label_button ),
+ "toggled",
+ G_CALLBACK( on_toolbar_same_label_toggled ),
+ instance );
+
+ label_widget = base_window_get_widget( BASE_WINDOW( instance ), "ToolbarLabelEntry" );
+ g_signal_connect(
+ G_OBJECT( label_widget ),
+ "changed",
+ G_CALLBACK( on_toolbar_label_changed ),
+ instance );
+ }
+}
+
+void
+nact_ibackground_tab_all_widgets_showed( NactIBackgroundTab *instance )
+{
+ static const gchar *thisfn = "nact_ibackground_tab_all_widgets_showed";
+
+ g_debug( "%s: instance=%p", thisfn, ( void * ) instance );
+ g_return_if_fail( NACT_IS_IBACKGROUND_TAB( instance ));
+
+ if( st_initialized && !st_finalized ){
+ }
+}
+
+void
+nact_ibackground_tab_dispose( NactIBackgroundTab *instance )
+{
+ static const gchar *thisfn = "nact_ibackground_tab_dispose";
+
+ g_debug( "%s: instance=%p", thisfn, ( void * ) instance );
+ g_return_if_fail( NACT_IS_IBACKGROUND_TAB( instance ));
+
+ if( st_initialized && !st_finalized ){
+ }
+}
+
+static void
+on_tab_updatable_selection_changed( NactIBackgroundTab *instance, gint count_selected )
+{
+ static const gchar *thisfn = "nact_ibackground_tab_on_tab_updatable_selection_changed";
+ NAObjectItem *item;
+ gboolean enable_tab;
+ GtkToggleButton *same_label_button;
+ gboolean same_label;
+ GtkWidget *short_label_widget;
+ gchar *short_label;
+
+ g_debug( "%s: instance=%p, count_selected=%d", thisfn, ( void * ) instance, count_selected );
+ g_return_if_fail( NACT_IS_IBACKGROUND_TAB( instance ));
+
+ if( st_initialized && !st_finalized ){
+
+ g_object_get(
+ G_OBJECT( instance ),
+ TAB_UPDATABLE_PROP_EDITED_ACTION, &item,
+ NULL );
+
+ g_return_if_fail( !item || NA_IS_OBJECT_ITEM( item ));
+
+ enable_tab = tab_set_sensitive( instance );
+
+ same_label_button = GTK_TOGGLE_BUTTON( base_window_get_widget( BASE_WINDOW( instance ), "ToolbarSameLabelButton" ));
+ same_label = enable_tab && NA_IS_OBJECT_ACTION( item ) ? na_object_action_toolbar_use_same_label( NA_OBJECT_ACTION( item )) : FALSE;
+ gtk_toggle_button_set_active( same_label_button, same_label );
+
+ short_label_widget = base_window_get_widget( BASE_WINDOW( instance ), "ToolbarLabelEntry" );
+ short_label = enable_tab && NA_IS_OBJECT_ACTION( item ) ? na_object_action_toolbar_get_label( NA_OBJECT_ACTION( item )) : g_strdup( "" );
+ gtk_entry_set_text( GTK_ENTRY( short_label_widget ), short_label );
+ g_free( short_label );
+ }
+}
+
+static void
+on_tab_updatable_enable_tab( NactIBackgroundTab *instance, NAObjectItem *item )
+{
+ static const gchar *thisfn = "nact_ibackground_tab_on_tab_updatable_enable_tab";
+
+ if( st_initialized && !st_finalized ){
+
+ g_debug( "%s: instance=%p, item=%p", thisfn, ( void * ) instance, ( void * ) item );
+ g_return_if_fail( NACT_IS_IBACKGROUND_TAB( instance ));
+
+ tab_set_sensitive( instance );
+ }
+}
+
+static gboolean
+tab_set_sensitive( NactIBackgroundTab *instance )
+{
+ NAObjectItem *item;
+ gboolean enable_tab;
+ gboolean target_toolbar;
+ gboolean enable_toolbar_frame;
+ GtkWidget *toolbar_frame_widget;
+ gboolean enable_toolbar_label_entry;
+ GtkWidget *toolbar_label_entry;
+
+ g_object_get(
+ G_OBJECT( instance ),
+ TAB_UPDATABLE_PROP_EDITED_ACTION, &item,
+ NULL );
+
+ target_toolbar = ( item && na_object_is_target_toolbar( item ));
+ enable_tab = ( item &&
+ ( na_object_is_target_background( item ) || target_toolbar ));
+ nact_main_tab_enable_page( NACT_MAIN_WINDOW( instance ), TAB_BACKGROUND, enable_tab );
+
+ enable_toolbar_frame = ( enable_tab && NA_IS_OBJECT_ACTION( item ) && target_toolbar );
+ toolbar_frame_widget = base_window_get_widget( BASE_WINDOW( instance ), "BackgroundToolbarFrame" );
+ gtk_widget_set_sensitive( toolbar_frame_widget, enable_toolbar_frame );
+
+ enable_toolbar_label_entry = ( enable_toolbar_frame && !na_object_action_toolbar_use_same_label( NA_OBJECT_ACTION( item )));
+ toolbar_label_entry = base_window_get_widget( BASE_WINDOW( instance ), "ToolbarLabelEntry" );
+ gtk_widget_set_sensitive( toolbar_label_entry, enable_toolbar_label_entry );
+
+ return( enable_tab );
+}
+
+static void
+on_toolbar_same_label_toggled( GtkToggleButton *button, NactIBackgroundTab *instance )
+{
+ NAObjectItem *edited;
+ gboolean same_label;
+ GtkWidget *label_widget;
+ gchar *text;
+
+ g_object_get(
+ G_OBJECT( instance ),
+ TAB_UPDATABLE_PROP_EDITED_ACTION, &edited,
+ NULL );
+
+ if( edited ){
+ g_return_if_fail( NA_IS_OBJECT_ACTION( edited ));
+
+ same_label = gtk_toggle_button_get_active( button );
+ na_object_action_toolbar_set_same_label( NA_OBJECT_ACTION( edited ), same_label );
+
+ tab_set_sensitive( instance );
+
+ if( same_label ){
+ label_widget = base_window_get_widget( BASE_WINDOW( instance ), "ToolbarLabelEntry" );
+ text = na_object_get_label( edited );
+ gtk_entry_set_text( GTK_ENTRY( label_widget ), text );
+ g_free( text );
+ }
+
+ g_signal_emit_by_name( G_OBJECT( instance ), TAB_UPDATABLE_SIGNAL_ITEM_UPDATED, edited, FALSE );
+ }
+}
+
+static void
+on_toolbar_label_changed( GtkEntry *entry, NactIBackgroundTab *instance )
+{
+ NAObjectItem *edited;
+ const gchar *label;
+
+ g_object_get(
+ G_OBJECT( instance ),
+ TAB_UPDATABLE_PROP_EDITED_ACTION, &edited,
+ NULL );
+
+ if( edited ){
+ g_return_if_fail( NA_IS_OBJECT_ACTION( edited ));
+
+ label = gtk_entry_get_text( entry );
+ na_object_action_toolbar_set_label( NA_OBJECT_ACTION( edited ), label );
+
+ g_signal_emit_by_name( G_OBJECT( instance ), TAB_UPDATABLE_SIGNAL_ITEM_UPDATED, edited, FALSE );
+ }
+}
diff --git a/src/nact/nact-ibackground-tab.h b/src/nact/nact-ibackground-tab.h
new file mode 100644
index 0000000..4661ec7
--- /dev/null
+++ b/src/nact/nact-ibackground-tab.h
@@ -0,0 +1,71 @@
+/*
+ * Nautilus Actions
+ * A Nautilus extension which offers configurable context menu actions.
+ *
+ * Copyright (C) 2005 The GNOME Foundation
+ * Copyright (C) 2006, 2007, 2008 Frederic Ruaudel and others (see AUTHORS)
+ * Copyright (C) 2009 Pierre Wieser and others (see AUTHORS)
+ *
+ * This Program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this Library; see the file COPYING. If not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place,
+ * Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Authors:
+ * Frederic Ruaudel <grumz grumz net>
+ * Rodrigo Moya <rodrigo gnome-db org>
+ * Pierre Wieser <pwieser trychlos org>
+ * ... and many others (see AUTHORS)
+ */
+
+#ifndef __NACT_IBACKGROUND_TAB_H__
+#define __NACT_IBACKGROUND_TAB_H__
+
+/**
+ * SECTION: nact_ibackground_tab
+ * @short_description: #NactIBackgroundTab interface declaration.
+ * @include: nact/nact-ibackground-tab.h
+ *
+ * This interface implements all the widgets which are relevant for
+ * items which are applied to backgrounds.
+ */
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define NACT_IBACKGROUND_TAB_TYPE ( nact_ibackground_tab_get_type())
+#define NACT_IBACKGROUND_TAB( object ) ( G_TYPE_CHECK_INSTANCE_CAST( object, NACT_IBACKGROUND_TAB_TYPE, NactIBackgroundTab ))
+#define NACT_IS_IBACKGROUND_TAB( object ) ( G_TYPE_CHECK_INSTANCE_TYPE( object, NACT_IBACKGROUND_TAB_TYPE ))
+#define NACT_IBACKGROUND_TAB_GET_INTERFACE( instance ) ( G_TYPE_INSTANCE_GET_INTERFACE(( instance ), NACT_IBACKGROUND_TAB_TYPE, NactIBackgroundTabInterface ))
+
+typedef struct NactIBackgroundTab NactIBackgroundTab;
+
+typedef struct NactIBackgroundTabInterfacePrivate NactIBackgroundTabInterfacePrivate;
+
+typedef struct {
+ GTypeInterface parent;
+ NactIBackgroundTabInterfacePrivate *private;
+}
+ NactIBackgroundTabInterface;
+
+GType nact_ibackground_tab_get_type( void );
+
+void nact_ibackground_tab_initial_load_toplevel( NactIBackgroundTab *instance );
+void nact_ibackground_tab_runtime_init_toplevel( NactIBackgroundTab *instance );
+void nact_ibackground_tab_all_widgets_showed( NactIBackgroundTab *instance );
+void nact_ibackground_tab_dispose( NactIBackgroundTab *instance );
+
+G_END_DECLS
+
+#endif /* __NACT_IBACKGROUND_TAB_H__ */
diff --git a/src/nact/nact-icommand-tab.c b/src/nact/nact-icommand-tab.c
index bcde9d6..bd76350 100644
--- a/src/nact/nact-icommand-tab.c
+++ b/src/nact/nact-icommand-tab.c
@@ -75,6 +75,8 @@ static void interface_base_finalize( NactICommandTabInterface *klass );
static void on_iactions_list_column_edited( NactICommandTab *instance, NAObject *object, gchar *text, gint column );
static void on_tab_updatable_selection_changed( NactICommandTab *instance, gint count_selected );
+static gboolean tab_set_sensitive( NactICommandTab *instance );
+
static void check_for_label( NactICommandTab *instance, GtkEntry *entry, const gchar *label );
static GtkWidget *get_label_entry( NactICommandTab *instance );
static GtkButton *get_legend_button( NactICommandTab *instance );
@@ -333,10 +335,11 @@ static void
on_tab_updatable_selection_changed( NactICommandTab *instance, gint count_selected )
{
static const gchar *thisfn = "nact_icommand_tab_on_tab_updatable_selection_changed";
- NAObjectProfile *profile = NULL;
+ NAObjectItem *item;
+ NAObjectProfile *profile;
+ gboolean enable_tab;
GtkWidget *label_entry, *path_entry, *parameters_entry;
gchar *label, *path, *parameters;
- GtkButton *path_button, *legend_button;
g_debug( "%s: instance=%p, count_selected=%d", thisfn, ( void * ) instance, count_selected );
g_return_if_fail( NACT_IS_ICOMMAND_TAB( instance ));
@@ -345,34 +348,47 @@ on_tab_updatable_selection_changed( NactICommandTab *instance, gint count_select
g_object_get(
G_OBJECT( instance ),
+ TAB_UPDATABLE_PROP_EDITED_ACTION, &item,
TAB_UPDATABLE_PROP_EDITED_PROFILE, &profile,
NULL );
+ enable_tab = tab_set_sensitive( instance );
+
label_entry = get_label_entry( instance );
- label = profile ? na_object_get_label( profile ) : g_strdup( "" );
+ label = enable_tab ? na_object_get_label( profile ) : g_strdup( "" );
gtk_entry_set_text( GTK_ENTRY( label_entry ), label );
- gtk_widget_set_sensitive( label_entry, profile != NULL );
check_for_label( instance, GTK_ENTRY( label_entry ), label );
g_free( label );
path_entry = get_path_entry( instance );
- path = profile ? na_object_profile_get_path( profile ) : g_strdup( "" );
+ path = enable_tab ? na_object_profile_get_path( profile ) : g_strdup( "" );
gtk_entry_set_text( GTK_ENTRY( path_entry ), path );
- gtk_widget_set_sensitive( path_entry, profile != NULL );
g_free( path );
parameters_entry = get_parameters_entry( instance );
- parameters = profile ? na_object_profile_get_parameters( profile ) : g_strdup( "" );
+ parameters = enable_tab ? na_object_profile_get_parameters( profile ) : g_strdup( "" );
gtk_entry_set_text( GTK_ENTRY( parameters_entry ), parameters );
- gtk_widget_set_sensitive( parameters_entry, profile != NULL );
g_free( parameters );
+ }
+}
- path_button = get_path_button( instance );
- gtk_widget_set_sensitive( GTK_WIDGET( path_button ), profile != NULL );
+static gboolean
+tab_set_sensitive( NactICommandTab *instance )
+{
+ NAObjectItem *item;
+ NAObjectProfile *profile;
+ gboolean enable_tab;
- legend_button = get_legend_button( instance );
- gtk_widget_set_sensitive( GTK_WIDGET( legend_button ), profile != NULL );
- }
+ g_object_get(
+ G_OBJECT( instance ),
+ TAB_UPDATABLE_PROP_EDITED_ACTION, &item,
+ TAB_UPDATABLE_PROP_EDITED_PROFILE, &profile,
+ NULL );
+
+ enable_tab = ( profile != NULL );
+ nact_main_tab_enable_page( NACT_MAIN_WINDOW( instance ), TAB_COMMAND, enable_tab );
+
+ return( enable_tab );
}
static void
diff --git a/src/nact/nact-iconditions-tab.c b/src/nact/nact-iconditions-tab.c
index d33b49c..aaec312 100644
--- a/src/nact/nact-iconditions-tab.c
+++ b/src/nact/nact-iconditions-tab.c
@@ -39,7 +39,7 @@
#include <common/na-utils.h>
#include "base-iprefs.h"
-#include "base-window.h"
+#include "nact-main-window.h"
#include "nact-main-tab.h"
#include "nact-iconditions-tab.h"
@@ -57,6 +57,9 @@ static void interface_base_init( NactIConditionsTabInterface *klass );
static void interface_base_finalize( NactIConditionsTabInterface *klass );
static void on_tab_updatable_selection_changed( NactIConditionsTab *instance, gint count_selected );
+static void on_tab_updatable_enable_tab( NactIConditionsTab *instance, NAObjectItem *item );
+static gboolean tab_set_sensitive( NactIConditionsTab *instance );
+
static GtkWidget *get_basenames_entry( NactIConditionsTab *instance );
static GtkButton *get_both_button( NactIConditionsTab *instance );
static GtkButton *get_isdir_button( NactIConditionsTab *instance );
@@ -219,6 +222,12 @@ nact_iconditions_tab_runtime_init_toplevel( NactIConditionsTab *instance )
TAB_UPDATABLE_SIGNAL_SELECTION_CHANGED,
G_CALLBACK( on_tab_updatable_selection_changed ),
instance );
+
+ g_signal_connect(
+ G_OBJECT( instance ),
+ TAB_UPDATABLE_SIGNAL_ENABLE_TAB,
+ G_CALLBACK( on_tab_updatable_enable_tab ),
+ instance );
}
}
@@ -289,13 +298,13 @@ on_tab_updatable_selection_changed( NactIConditionsTab *instance, gint count_sel
{
static const gchar *thisfn = "nact_iconditions_tab_on_tab_updatable_selection_changed";
NAObjectProfile *profile;
+ gboolean enable_tab;
GtkWidget *basenames_widget, *mimetypes_widget;
GSList *basenames, *mimetypes;
gchar *basenames_text, *mimetypes_text;
GtkButton *matchcase_button;
gboolean matchcase;
gboolean isfile, isdir;
- GtkButton *files_button, *dir_button, *both_button;
GtkButton *multiple_button;
gboolean multiple;
@@ -309,44 +318,70 @@ on_tab_updatable_selection_changed( NactIConditionsTab *instance, gint count_sel
TAB_UPDATABLE_PROP_EDITED_PROFILE, &profile,
NULL );
+ enable_tab = tab_set_sensitive( instance );
+
basenames_widget = get_basenames_entry( instance );
- basenames = profile ? na_object_profile_get_basenames( profile ) : NULL;
+ basenames = enable_tab ? na_object_profile_get_basenames( profile ) : NULL;
basenames_text = profile ? na_utils_string_list_to_text( basenames ) : g_strdup( "" );
gtk_entry_set_text( GTK_ENTRY( basenames_widget ), basenames_text );
g_free( basenames_text );
na_utils_free_string_list( basenames );
- gtk_widget_set_sensitive( basenames_widget, profile != NULL );
matchcase_button = get_matchcase_button( instance );
- matchcase = profile ? na_object_profile_get_matchcase( profile ) : FALSE;
+ matchcase = enable_tab ? na_object_profile_get_matchcase( profile ) : FALSE;
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( matchcase_button ), matchcase );
- gtk_widget_set_sensitive( GTK_WIDGET( matchcase_button ), profile != NULL );
mimetypes_widget = get_mimetypes_entry( instance );
- mimetypes = profile ? na_object_profile_get_mimetypes( profile ) : NULL;
+ mimetypes = enable_tab ? na_object_profile_get_mimetypes( profile ) : NULL;
mimetypes_text = profile ? na_utils_string_list_to_text( mimetypes ) : g_strdup( "" );
gtk_entry_set_text( GTK_ENTRY( mimetypes_widget ), mimetypes_text );
g_free( mimetypes_text );
na_utils_free_string_list( mimetypes );
- gtk_widget_set_sensitive( mimetypes_widget, profile != NULL );
- isfile = profile ? na_object_profile_get_is_file( profile ) : FALSE;
- isdir = profile ? na_object_profile_get_is_dir( profile ) : FALSE;
+ isfile = enable_tab ? na_object_profile_get_is_file( profile ) : FALSE;
+ isdir = enable_tab ? na_object_profile_get_is_dir( profile ) : FALSE;
set_isfiledir( instance, isfile, isdir );
- files_button = get_isfile_button( instance );
- gtk_widget_set_sensitive( GTK_WIDGET( files_button ), profile != NULL );
- dir_button = get_isdir_button( instance );
- gtk_widget_set_sensitive( GTK_WIDGET( dir_button ), profile != NULL );
- both_button = get_both_button( instance );
- gtk_widget_set_sensitive( GTK_WIDGET( both_button ), profile != NULL );
multiple_button = get_multiple_button( instance );
- multiple = profile ? na_object_profile_get_multiple( profile ) : FALSE;
+ multiple = enable_tab ? na_object_profile_get_multiple( profile ) : FALSE;
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( multiple_button ), multiple );
- gtk_widget_set_sensitive( GTK_WIDGET( multiple_button ), profile != NULL );
}
}
+static void
+on_tab_updatable_enable_tab( NactIConditionsTab *instance, NAObjectItem *item )
+{
+ static const gchar *thisfn = "nact_iconditions_tab_on_tab_updatable_enable_tab";
+
+ if( st_initialized && !st_finalized ){
+
+ g_debug( "%s: instance=%p, item=%p", thisfn, ( void * ) instance, ( void * ) item );
+ g_return_if_fail( NACT_IS_ICONDITIONS_TAB( instance ));
+
+ tab_set_sensitive( instance );
+
+ }
+}
+
+static gboolean
+tab_set_sensitive( NactIConditionsTab *instance )
+{
+ NAObjectItem *item;
+ NAObjectProfile *profile;
+ gboolean enable_tab;
+
+ g_object_get(
+ G_OBJECT( instance ),
+ TAB_UPDATABLE_PROP_EDITED_ACTION, &item,
+ TAB_UPDATABLE_PROP_EDITED_PROFILE, &profile,
+ NULL );
+
+ enable_tab = ( profile != NULL && na_object_is_target_selection( item ));
+ nact_main_tab_enable_page( NACT_MAIN_WINDOW( instance ), TAB_CONDITIONS, enable_tab );
+
+ return( enable_tab );
+}
+
static GtkWidget *
get_basenames_entry( NactIConditionsTab *instance )
{
@@ -413,7 +448,8 @@ on_basenames_changed( GtkEntry *entry, NactIConditionsTab *instance )
/*
* Note that this callback is triggered twice: first, for the
* deactivated button, then a second time for the newly activated one.
- * I don't know what to do to be triggered only once..?
+ * To avoid a double execution, we only run the code when the button
+ * becomes active
*/
static void
on_isfiledir_toggled( GtkToggleButton *button, NactIConditionsTab *instance )
@@ -422,15 +458,18 @@ on_isfiledir_toggled( GtkToggleButton *button, NactIConditionsTab *instance )
NAObjectProfile *edited;
gboolean isfile, isdir;
- g_object_get(
- G_OBJECT( instance ),
- TAB_UPDATABLE_PROP_EDITED_PROFILE, &edited,
- NULL );
+ if( gtk_toggle_button_get_active( button )){
- if( edited ){
- nact_iconditions_tab_get_isfiledir( instance, &isfile, &isdir );
- na_object_profile_set_isfiledir( edited, isfile, isdir );
- g_signal_emit_by_name( G_OBJECT( instance ), TAB_UPDATABLE_SIGNAL_ITEM_UPDATED, edited, FALSE );
+ g_object_get(
+ G_OBJECT( instance ),
+ TAB_UPDATABLE_PROP_EDITED_PROFILE, &edited,
+ NULL );
+
+ if( edited ){
+ nact_iconditions_tab_get_isfiledir( instance, &isfile, &isdir );
+ na_object_profile_set_isfiledir( edited, isfile, isdir );
+ g_signal_emit_by_name( G_OBJECT( instance ), TAB_UPDATABLE_SIGNAL_ITEM_UPDATED, edited, FALSE );
+ }
}
}
diff --git a/src/nact/nact-main-tab.c b/src/nact/nact-main-tab.c
new file mode 100644
index 0000000..99db97e
--- /dev/null
+++ b/src/nact/nact-main-tab.c
@@ -0,0 +1,49 @@
+/*
+ * Nautilus Actions
+ * A Nautilus extension which offers configurable context menu actions.
+ *
+ * Copyright (C) 2005 The GNOME Foundation
+ * Copyright (C) 2006, 2007, 2008 Frederic Ruaudel and others (see AUTHORS)
+ * Copyright (C) 2009 Pierre Wieser and others (see AUTHORS)
+ *
+ * This Program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this Library; see the file COPYING. If not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place,
+ * Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Authors:
+ * Frederic Ruaudel <grumz grumz net>
+ * Rodrigo Moya <rodrigo gnome-db org>
+ * Pierre Wieser <pwieser trychlos org>
+ * ... and many others (see AUTHORS)
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "nact-main-tab.h"
+
+void
+nact_main_tab_enable_page( NactMainWindow *window, gint num_page, gboolean enabled )
+{
+ GtkNotebook *notebook;
+ GtkWidget *page, *label;
+
+ notebook = GTK_NOTEBOOK( base_window_get_widget( BASE_WINDOW( window ), "MainNotebook" ));
+ page = gtk_notebook_get_nth_page( notebook, num_page );
+ gtk_widget_set_sensitive( page, enabled );
+
+ label = gtk_notebook_get_tab_label( notebook, page );
+ gtk_widget_set_sensitive( label, enabled );
+}
diff --git a/src/nact/nact-main-tab.h b/src/nact/nact-main-tab.h
index 5a0d7e5..56f7db3 100644
--- a/src/nact/nact-main-tab.h
+++ b/src/nact/nact-main-tab.h
@@ -31,6 +31,8 @@
#ifndef __NACT_MAIN_TAB_H__
#define __NACT_MAIN_TAB_H__
+#include "nact-main-window.h"
+
/**
* SECTION: nact_main_tab
* @short_description: Signals and properties.
@@ -49,6 +51,20 @@
*/
#define TAB_UPDATABLE_SIGNAL_SELECTION_CHANGED "nact-tab-updatable-selection-changed"
#define TAB_UPDATABLE_SIGNAL_ITEM_UPDATED "nact-tab-updatable-item-updated"
+#define TAB_UPDATABLE_SIGNAL_ENABLE_TAB "nact-tab-updatable-enable-tab"
+
+/* notebook tabs
+ */
+
+enum {
+ TAB_ACTION = 0,
+ TAB_COMMAND,
+ TAB_BACKGROUND,
+ TAB_CONDITIONS,
+ TAB_ADVANCED
+};
+
+void nact_main_tab_enable_page( NactMainWindow *window, gint page, gboolean enabled );
G_END_DECLS
diff --git a/src/nact/nact-main-window.c b/src/nact/nact-main-window.c
index 55fa5bc..c9fd52b 100644
--- a/src/nact/nact-main-window.c
+++ b/src/nact/nact-main-window.c
@@ -50,6 +50,7 @@
#include "nact-iactions-list.h"
#include "nact-iaction-tab.h"
#include "nact-icommand-tab.h"
+#include "nact-ibackground-tab.h"
#include "nact-iconditions-tab.h"
#include "nact-iadvanced-tab.h"
#include "nact-main-tab.h"
@@ -118,6 +119,7 @@ enum {
enum {
SELECTION_CHANGED,
ITEM_UPDATED,
+ ENABLE_TAB,
UPDATE_SENSITIVITIES,
ORDER_CHANGED,
LAST_SIGNAL
@@ -131,6 +133,7 @@ static void class_init( NactMainWindowClass *klass );
static void iactions_list_iface_init( NactIActionsListInterface *iface );
static void iaction_tab_iface_init( NactIActionTabInterface *iface );
static void icommand_tab_iface_init( NactICommandTabInterface *iface );
+static void ibackground_tab_iface_init( NactIBackgroundTabInterface *iface );
static void iconditions_tab_iface_init( NactIConditionsTabInterface *iface );
static void iadvanced_tab_iface_init( NactIAdvancedTabInterface *iface );
static void iabout_iface_init( NAIAboutInterface *iface );
@@ -215,6 +218,12 @@ register_type( void )
NULL
};
+ static const GInterfaceInfo ibackground_tab_iface_info = {
+ ( GInterfaceInitFunc ) ibackground_tab_iface_init,
+ NULL,
+ NULL
+ };
+
static const GInterfaceInfo iconditions_tab_iface_info = {
( GInterfaceInitFunc ) iconditions_tab_iface_init,
NULL,
@@ -255,6 +264,8 @@ register_type( void )
g_type_add_interface_static( type, NACT_ICOMMAND_TAB_TYPE, &icommand_tab_iface_info );
+ g_type_add_interface_static( type, NACT_IBACKGROUND_TAB_TYPE, &ibackground_tab_iface_info );
+
g_type_add_interface_static( type, NACT_ICONDITIONS_TAB_TYPE, &iconditions_tab_iface_info );
g_type_add_interface_static( type, NACT_IADVANCED_TAB_TYPE, &iadvanced_tab_iface_info );
@@ -362,6 +373,25 @@ class_init( NactMainWindowClass *klass )
G_TYPE_POINTER );
/**
+ * nact-tab-updatable-enable-tab:
+ *
+ * This signal is emitted by the IActionTab when the nature of the
+ * item has been modified: some tabs should probably be enabled or
+ * disabled
+ */
+ st_signals[ ENABLE_TAB ] = g_signal_new(
+ TAB_UPDATABLE_SIGNAL_ENABLE_TAB,
+ G_TYPE_OBJECT,
+ G_SIGNAL_RUN_LAST,
+ 0, /* no default handler */
+ NULL,
+ NULL,
+ g_cclosure_marshal_VOID__POINTER,
+ G_TYPE_NONE,
+ 1,
+ G_TYPE_POINTER );
+
+ /**
* main-window-update-sensitivities:
*
* This signal is emitted each time a user interaction may led the
@@ -426,6 +456,14 @@ icommand_tab_iface_init( NactICommandTabInterface *iface )
}
static void
+ibackground_tab_iface_init( NactIBackgroundTabInterface *iface )
+{
+ static const gchar *thisfn = "nact_main_window_ibackground_tab_iface_init";
+
+ g_debug( "%s: iface=%p", thisfn, ( void * ) iface );
+}
+
+static void
iconditions_tab_iface_init( NactIConditionsTabInterface *iface )
{
static const gchar *thisfn = "nact_main_window_iconditions_tab_iface_init";
@@ -602,6 +640,7 @@ instance_dispose( GObject *window )
nact_iactions_list_dispose( NACT_IACTIONS_LIST( window ));
nact_iaction_tab_dispose( NACT_IACTION_TAB( window ));
nact_icommand_tab_dispose( NACT_ICOMMAND_TAB( window ));
+ nact_ibackground_tab_dispose( NACT_IBACKGROUND_TAB( window ));
nact_iconditions_tab_dispose( NACT_ICONDITIONS_TAB( window ));
nact_iadvanced_tab_dispose( NACT_IADVANCED_TAB( window ));
nact_main_menubar_dispose( self );
@@ -907,6 +946,7 @@ on_base_initial_load_toplevel( NactMainWindow *window, gpointer user_data )
nact_iaction_tab_initial_load_toplevel( NACT_IACTION_TAB( window ));
nact_icommand_tab_initial_load_toplevel( NACT_ICOMMAND_TAB( window ));
+ nact_ibackground_tab_initial_load_toplevel( NACT_IBACKGROUND_TAB( window ));
nact_iconditions_tab_initial_load_toplevel( NACT_ICONDITIONS_TAB( window ));
nact_iadvanced_tab_initial_load_toplevel( NACT_IADVANCED_TAB( window ));
}
@@ -941,6 +981,7 @@ on_base_runtime_init_toplevel( NactMainWindow *window, gpointer user_data )
nact_iaction_tab_runtime_init_toplevel( NACT_IACTION_TAB( window ));
nact_icommand_tab_runtime_init_toplevel( NACT_ICOMMAND_TAB( window ));
+ nact_ibackground_tab_runtime_init_toplevel( NACT_IBACKGROUND_TAB( window ));
nact_iconditions_tab_runtime_init_toplevel( NACT_ICONDITIONS_TAB( window ));
nact_iadvanced_tab_runtime_init_toplevel( NACT_IADVANCED_TAB( window ));
nact_main_menubar_runtime_init( window );
@@ -972,6 +1013,7 @@ on_base_all_widgets_showed( NactMainWindow *window, gpointer user_data )
g_return_if_fail( NACT_IS_IACTIONS_LIST( window ));
g_return_if_fail( NACT_IS_IACTION_TAB( window ));
g_return_if_fail( NACT_IS_ICOMMAND_TAB( window ));
+ g_return_if_fail( NACT_IS_IBACKGROUND_TAB( window ));
g_return_if_fail( NACT_IS_ICONDITIONS_TAB( window ));
g_return_if_fail( NACT_IS_IADVANCED_TAB( window ));
@@ -980,6 +1022,7 @@ on_base_all_widgets_showed( NactMainWindow *window, gpointer user_data )
nact_iactions_list_all_widgets_showed( NACT_IACTIONS_LIST( window ));
nact_iaction_tab_all_widgets_showed( NACT_IACTION_TAB( window ));
nact_icommand_tab_all_widgets_showed( NACT_ICOMMAND_TAB( window ));
+ nact_ibackground_tab_all_widgets_showed( NACT_IBACKGROUND_TAB( window ));
nact_iconditions_tab_all_widgets_showed( NACT_ICONDITIONS_TAB( window ));
nact_iadvanced_tab_all_widgets_showed( NACT_IADVANCED_TAB( window ));
}
diff --git a/src/nact/nact-xml-reader.c b/src/nact/nact-xml-reader.c
index c213b63..0d6cfbb 100644
--- a/src/nact/nact-xml-reader.c
+++ b/src/nact/nact-xml-reader.c
@@ -98,6 +98,13 @@ static GConfReaderStruct reader_str[] = {
{ OBJECT_ITEM_TOOLTIP_ENTRY , FALSE, TRUE, FALSE, FALSE },
{ OBJECT_ITEM_ICON_ENTRY , FALSE, FALSE, FALSE, FALSE },
{ OBJECT_ITEM_ENABLED_ENTRY , FALSE, FALSE, FALSE, FALSE },
+ { OBJECT_ITEM_LIST_ENTRY , FALSE, FALSE, FALSE, FALSE },
+ { OBJECT_ITEM_TYPE_ENTRY , FALSE, FALSE, FALSE, FALSE },
+ { OBJECT_ITEM_TARGET_SELECTION_ENTRY , FALSE, FALSE, FALSE, FALSE },
+ { OBJECT_ITEM_TARGET_BACKGROUND_ENTRY , FALSE, FALSE, FALSE, FALSE },
+ { OBJECT_ITEM_TARGET_TOOLBAR_ENTRY , FALSE, FALSE, FALSE, FALSE },
+ { OBJECT_ITEM_TOOLBAR_SAME_LABEL_ENTRY, FALSE, FALSE, FALSE, FALSE },
+ { OBJECT_ITEM_TOOLBAR_LABEL_ENTRY , TRUE, FALSE, FALSE, FALSE },
{ ACTION_PROFILE_LABEL_ENTRY, FALSE, TRUE, TRUE, FALSE },
{ ACTION_PATH_ENTRY , FALSE, FALSE, TRUE, FALSE },
{ ACTION_PARAMETERS_ENTRY , FALSE, FALSE, TRUE, FALSE },
@@ -108,6 +115,7 @@ static GConfReaderStruct reader_str[] = {
{ ACTION_MULTIPLE_ENTRY , FALSE, FALSE, TRUE, FALSE },
{ ACTION_MIMETYPES_ENTRY , FALSE, FALSE, TRUE, TRUE },
{ ACTION_SCHEMES_ENTRY , FALSE, FALSE, TRUE, TRUE },
+ { ACTION_FOLDERS_ENTRY , FALSE, FALSE, TRUE, TRUE },
{ NULL, FALSE, FALSE, FALSE, FALSE },
};
@@ -1114,7 +1122,7 @@ get_profile_name_from_dump_key( const gchar *key )
static void
apply_values( NactXMLReader *reader )
{
- static const gchar *thisfn = "gconf_reader_apply_values";
+ static const gchar *thisfn = "nact_xml_reader_apply_values";
g_debug( "%s: reader=%p, entry=%s, value=%s",
thisfn, ( void * ) reader, reader->private->entry, reader->private->value );
@@ -1135,6 +1143,30 @@ apply_values( NactXMLReader *reader )
} else if( !strcmp( reader->private->entry, OBJECT_ITEM_ENABLED_ENTRY )){
na_object_set_enabled( NA_OBJECT_ITEM( reader->private->action ), na_utils_schema_to_boolean( reader->private->value, TRUE ));
+ } else if( !strcmp( reader->private->entry, OBJECT_ITEM_LIST_ENTRY )){
+ na_object_item_set_items_string_list( NA_OBJECT_ITEM( reader->private->action ), reader->private->list_value );
+
+ } else if( !strcmp( reader->private->entry, OBJECT_ITEM_TYPE_ENTRY )){
+ /* type (Action, Menu) is not set here, because this must has been
+ * decided at object construction (it is so too late !)
+ */
+ ;
+
+ } else if( !strcmp( reader->private->entry, OBJECT_ITEM_TARGET_SELECTION_ENTRY )){
+ na_object_set_target_selection( reader->private->action, na_utils_schema_to_boolean( reader->private->value, TRUE ));
+
+ } else if( !strcmp( reader->private->entry, OBJECT_ITEM_TARGET_BACKGROUND_ENTRY )){
+ na_object_set_target_background( reader->private->action, na_utils_schema_to_boolean( reader->private->value, FALSE ));
+
+ } else if( !strcmp( reader->private->entry, OBJECT_ITEM_TARGET_TOOLBAR_ENTRY )){
+ na_object_set_target_toolbar( reader->private->action, na_utils_schema_to_boolean( reader->private->value, FALSE ));
+
+ } else if( !strcmp( reader->private->entry, OBJECT_ITEM_TOOLBAR_SAME_LABEL_ENTRY )){
+ na_object_action_toolbar_set_same_label( reader->private->action, na_utils_schema_to_boolean( reader->private->value, FALSE ));
+
+ } else if( !strcmp( reader->private->entry, OBJECT_ITEM_TOOLBAR_LABEL_ENTRY )){
+ na_object_action_toolbar_set_label( reader->private->action, reader->private->value );
+
} else if( !strcmp( reader->private->entry, ACTION_PROFILE_LABEL_ENTRY )){
na_object_set_label( reader->private->profile, reader->private->value );
@@ -1165,8 +1197,11 @@ apply_values( NactXMLReader *reader )
} else if( !strcmp( reader->private->entry, ACTION_SCHEMES_ENTRY )){
na_object_profile_set_schemes( reader->private->profile, reader->private->list_value );
+ } else if( !strcmp( reader->private->entry, ACTION_FOLDERS_ENTRY )){
+ na_object_profile_set_folders( reader->private->profile, reader->private->list_value );
+
} else {
- g_assert_not_reached();
+ g_warning( "%s: unprocessed entry %s", thisfn, reader->private->entry );
}
}
}
diff --git a/src/nact/nautilus-actions-config-tool.ui b/src/nact/nautilus-actions-config-tool.ui
index 18f282c..59073e0 100644
--- a/src/nact/nautilus-actions-config-tool.ui
+++ b/src/nact/nautilus-actions-config-tool.ui
@@ -90,183 +90,266 @@
<property name="border_width">6</property>
<property name="spacing">10</property>
<child>
- <object class="GtkVBox" id="vbox4">
+ <object class="GtkFrame" id="frame7">
<property name="visible">True</property>
- <property name="spacing">10</property>
- <child>
- <object class="GtkLabel" id="label2">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes"><b>Nautilus Menu Item</b></property>
- <property name="use_markup">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">0</property>
- </packing>
- </child>
+ <property name="label_xalign">0</property>
+ <property name="shadow_type">in</property>
<child>
- <object class="GtkTable" id="table1">
+ <object class="GtkAlignment" id="alignment7">
<property name="visible">True</property>
- <property name="n_rows">3</property>
- <property name="n_columns">2</property>
- <property name="column_spacing">6</property>
- <property name="row_spacing">6</property>
- <child>
- <object class="GtkLabel" id="ActionLabelLabel">
- <property name="visible">True</property>
- <property name="xalign">1</property>
- <property name="label" translatable="yes">_Label :</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">ActionLabelEntry</property>
- </object>
- <packing>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="ActionTooltipLabel">
- <property name="visible">True</property>
- <property name="xalign">1</property>
- <property name="label" translatable="yes">_Tooltip :</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">ActionTooltipEntry</property>
- </object>
- <packing>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="ActionIconLabel">
- <property name="visible">True</property>
- <property name="xalign">1</property>
- <property name="label" translatable="yes">_Icon :</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">ActionIconComboBoxEntry</property>
- </object>
- <packing>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkEntry" id="ActionLabelEntry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="tooltip_text" translatable="yes">Label of the menu item in the Nautilus popup menu.</property>
- <property name="invisible_char">●</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- </packing>
- </child>
+ <property name="top_padding">6</property>
+ <property name="bottom_padding">6</property>
+ <property name="left_padding">12</property>
+ <property name="right_padding">6</property>
<child>
- <object class="GtkEntry" id="ActionTooltipEntry">
+ <object class="GtkTable" id="table1">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="tooltip_text" translatable="yes">Tooltip of the menu item that will appear in the Nautilus statusbar.</property>
- <property name="invisible_char">●</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkHBox" id="hbox2">
- <property name="visible">True</property>
- <property name="spacing">6</property>
+ <property name="n_rows">4</property>
+ <property name="n_columns">2</property>
+ <property name="column_spacing">6</property>
+ <property name="row_spacing">6</property>
<child>
- <object class="GtkAspectFrame" id="ActionIconFrame">
- <property name="width_request">24</property>
- <property name="height_request">24</property>
+ <object class="GtkLabel" id="ActionLabelLabel">
<property name="visible">True</property>
- <property name="label_xalign">0</property>
- <property name="shadow_type">in</property>
- <property name="obey_child">False</property>
- <child>
- <object class="GtkImage" id="ActionIconImage">
- <property name="stock">gnome-stock-blank</property>
- <property name="icon-size">4</property>
- </object>
- </child>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">_Label :</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">ActionLabelEntry</property>
</object>
<packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="ActionTooltipLabel">
+ <property name="visible">True</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">_Tooltip :</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">ActionTooltipEntry</property>
+ </object>
+ <packing>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="ActionIconLabel">
+ <property name="visible">True</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">_Icon :</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">ActionIconComboBoxEntry</property>
+ </object>
+ <packing>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="ActionLabelEntry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="tooltip_text" translatable="yes">Label of the menu item in the Nautilus popup menu.</property>
+ <property name="invisible_char">●</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="ActionTooltipEntry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="tooltip_text" translatable="yes">Tooltip of the menu item that will appear in the Nautilus statusbar.</property>
+ <property name="invisible_char">●</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
</packing>
</child>
<child>
- <object class="GtkComboBoxEntry" id="ActionIconComboBoxEntry">
+ <object class="GtkHBox" id="hbox2">
<property name="visible">True</property>
- <property name="tooltip_text" translatable="yes">Select the icon which will appear in the Nautilus context menu.</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkAspectFrame" id="ActionIconFrame">
+ <property name="width_request">24</property>
+ <property name="height_request">24</property>
+ <property name="visible">True</property>
+ <property name="label_xalign">0</property>
+ <property name="shadow_type">in</property>
+ <property name="obey_child">False</property>
+ <child>
+ <object class="GtkImage" id="ActionIconImage">
+ <property name="stock">gnome-stock-blank</property>
+ <property name="icon-size">4</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBoxEntry" id="ActionIconComboBoxEntry">
+ <property name="visible">True</property>
+ <property name="tooltip_text" translatable="yes">Select the icon which will appear in the Nautilus context menu.</property>
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderertext1"/>
+ <attributes>
+ <attribute name="text">0</attribute>
+ </attributes>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
<child>
- <object class="GtkCellRendererText" id="cellrenderertext1"/>
- <attributes>
- <attribute name="text">0</attribute>
- </attributes>
+ <object class="GtkButton" id="ActionIconBrowseButton">
+ <property name="label" translatable="yes">_Browse...</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="tooltip_text" translatable="yes">Click to choose a custom icon from a file instead of a predefined icon from the drop-down list.</property>
+ <property name="image">image3</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">2</property>
+ </packing>
</child>
</object>
<packing>
- <property name="position">1</property>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
</packing>
</child>
<child>
- <object class="GtkButton" id="ActionIconBrowseButton">
- <property name="label" translatable="yes">_Browse...</property>
+ <object class="GtkLabel" id="ActionItemID">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="tooltip_text" translatable="yes">Click to choose a custom icon from a file instead of a predefined icon from the drop-down list.</property>
- <property name="image">image3</property>
- <property name="use_underline">True</property>
+ <property name="xalign">0</property>
</object>
<packing>
- <property name="expand">False</property>
- <property name="position">2</property>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
</packing>
</child>
+ <child>
+ <placeholder/>
+ </child>
</object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- </packing>
</child>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="position">1</property>
- </packing>
+ </child>
+ <child type="label">
+ <object class="GtkLabel" id="label52">
+ <property name="visible">True</property>
+ <property name="xpad">5</property>
+ <property name="label" translatable="yes"><b>Nautilus Menu Item</b></property>
+ <property name="use_markup">True</property>
+ </object>
</child>
</object>
<packing>
<property name="expand">False</property>
- <property name="padding">10</property>
<property name="position">0</property>
</packing>
</child>
<child>
- <object class="GtkVBox" id="vbox15">
+ <object class="GtkHBox" id="hbox1">
<property name="visible">True</property>
<property name="spacing">10</property>
<child>
- <object class="GtkLabel" id="ActionPropertiesGroupTitle">
+ <object class="GtkFrame" id="frame13">
<property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes"><b>Action properties</b></property>
- <property name="use_markup">True</property>
+ <property name="label_xalign">0</property>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkAlignment" id="alignment13">
+ <property name="visible">True</property>
+ <property name="top_padding">6</property>
+ <property name="bottom_padding">6</property>
+ <property name="left_padding">12</property>
+ <property name="right_padding">6</property>
+ <child>
+ <object class="GtkVBox" id="vbox7">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkCheckButton" id="ActionTargetSelectionButton">
+ <property name="label" translatable="yes">Targets _selection menus</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 checked, the action or menu will be candidate to be displayed in Nautilus context menus when there is a selection. The item will also appear in Nautilus Edit menu.</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="ActionTargetBackgroundButton">
+ <property name="label" translatable="yes">Targets _background menus</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 checked, the item will be candidate to be displayed in Nautilus context menu when there is no selection. The item will also appear in Nautilus File menu.</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="ActionTargetToolbarButton">
+ <property name="label" translatable="yes">Targets _toolbar display</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 checked, the action will be displayed in Nautilus toolbar.
+Note that this only applies for now to actions which target background menus.</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child type="label">
+ <object class="GtkLabel" id="ActionTargetsTitle">
+ <property name="visible">True</property>
+ <property name="xpad">5</property>
+ <property name="label" translatable="yes"><b>Action targets</b></property>
+ <property name="use_markup">True</property>
+ </object>
+ </child>
</object>
<packing>
<property name="expand">False</property>
@@ -274,64 +357,61 @@
</packing>
</child>
<child>
- <object class="GtkTable" id="table4">
+ <object class="GtkFrame" id="frame8">
<property name="visible">True</property>
- <property name="n_rows">2</property>
- <property name="n_columns">2</property>
- <child>
- <object class="GtkCheckButton" id="ActionEnabledButton">
- <property name="label" translatable="yes">E_nabled</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 the action is disabled, it will never appear in the Nautilus context menu.</property>
- <property name="use_underline">True</property>
- <property name="draw_indicator">True</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="x_options">GTK_FILL</property>
- </packing>
- </child>
+ <property name="label_xalign">0</property>
+ <property name="shadow_type">in</property>
<child>
- <object class="GtkCheckButton" id="ActionReadonlyButton">
- <property name="label" translatable="yes">_Read-only</property>
- <property name="visible">True</property>
- <property name="sensitive">False</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">If only readable, the action cannot be edited.</property>
- <property name="use_underline">True</property>
- <property name="draw_indicator">True</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label4">
- <property name="width_request">20</property>
+ <object class="GtkAlignment" id="alignment8">
<property name="visible">True</property>
+ <property name="top_padding">6</property>
+ <property name="bottom_padding">6</property>
+ <property name="left_padding">12</property>
+ <property name="right_padding">6</property>
+ <child>
+ <object class="GtkVBox" id="vbox43">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkCheckButton" id="ActionEnabledButton">
+ <property name="label" translatable="yes">E_nabled</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 the action is disabled, it will never appear in the Nautilus context menu.</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="ActionReadonlyButton">
+ <property name="label" translatable="yes">_Read-only</property>
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="tooltip_text" translatable="yes">If only readable, the action cannot be edited.</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ </child>
</object>
- <packing>
- <property name="x_options"></property>
- </packing>
</child>
- <child>
- <object class="GtkLabel" id="label8">
- <property name="width_request">20</property>
+ <child type="label">
+ <object class="GtkLabel" id="ActionPropertiesTitle">
<property name="visible">True</property>
+ <property name="xpad">5</property>
+ <property name="label" translatable="yes"><b>Action properties</b></property>
+ <property name="use_markup">True</property>
</object>
- <packing>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options"></property>
- </packing>
</child>
</object>
<packing>
@@ -341,6 +421,7 @@
</child>
</object>
<packing>
+ <property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
@@ -361,25 +442,19 @@
<object class="GtkVBox" id="vbox5">
<property name="visible">True</property>
<property name="border_width">6</property>
+ <property name="spacing">10</property>
<child>
- <object class="GtkVBox" id="vbox6">
+ <object class="GtkFrame" id="frame9">
<property name="visible">True</property>
- <property name="spacing">10</property>
+ <property name="label_xalign">0</property>
+ <property name="shadow_type">in</property>
<child>
- <object class="GtkVBox" id="vbox7">
+ <object class="GtkAlignment" id="alignment9">
<property name="visible">True</property>
- <property name="spacing">10</property>
- <child>
- <object class="GtkLabel" id="label10">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes"><b>Profile</b></property>
- <property name="use_markup">True</property>
- </object>
- <packing>
- <property name="position">0</property>
- </packing>
- </child>
+ <property name="top_padding">6</property>
+ <property name="bottom_padding">6</property>
+ <property name="left_padding">12</property>
+ <property name="right_padding">6</property>
<child>
<object class="GtkHBox" id="hbox3">
<property name="visible">True</property>
@@ -401,7 +476,7 @@
<object class="GtkEntry" id="ProfileLabelEntry">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="tooltip_text" translatable="yes">The name of the profile.</property>
+ <property name="tooltip_text" translatable="yes">The name of the profile. It is only used in Nautilus Actions Configuration Tool user interface.</property>
<property name="invisible_char">●</property>
</object>
<packing>
@@ -409,34 +484,39 @@
</packing>
</child>
</object>
- <packing>
- <property name="position">1</property>
- </packing>
</child>
</object>
- <packing>
- <property name="position">0</property>
- </packing>
</child>
+ <child type="label">
+ <object class="GtkLabel" id="label53">
+ <property name="visible">True</property>
+ <property name="xpad">5</property>
+ <property name="label" translatable="yes"><b>Profile</b></property>
+ <property name="use_markup">True</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkFrame" id="frame10">
+ <property name="visible">True</property>
+ <property name="label_xalign">0</property>
+ <property name="shadow_type">in</property>
<child>
- <object class="GtkVBox" id="vbox8">
+ <object class="GtkAlignment" id="alignment10">
<property name="visible">True</property>
- <property name="spacing">10</property>
- <child>
- <object class="GtkLabel" id="label12">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes"><b>Command</b></property>
- <property name="use_markup">True</property>
- </object>
- <packing>
- <property name="position">0</property>
- </packing>
- </child>
+ <property name="top_padding">6</property>
+ <property name="bottom_padding">6</property>
+ <property name="left_padding">12</property>
+ <property name="right_padding">6</property>
<child>
<object class="GtkTable" id="table2">
<property name="visible">True</property>
- <property name="n_rows">2</property>
+ <property name="n_rows">3</property>
<property name="n_columns">3</property>
<property name="column_spacing">6</property>
<property name="row_spacing">6</property>
@@ -455,6 +535,7 @@
<child>
<object class="GtkLabel" id="CommandParametersLabel">
<property name="visible">True</property>
+ <property name="xalign">1</property>
<property name="label" translatable="yes">P_arameters :</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">CommandParametersEntry</property>
@@ -527,50 +608,41 @@
<property name="y_options"></property>
</packing>
</child>
- </object>
- <packing>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkHBox" id="hbox1">
- <property name="visible">True</property>
- <child>
- <object class="GtkLabel" id="CommandExamplePreLabel">
- <property name="visible">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">0</property>
- </packing>
- </child>
<child>
<object class="GtkLabel" id="CommandExampleLabel">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="use_markup">True</property>
- <property name="wrap">True</property>
</object>
<packing>
- <property name="position">1</property>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
</packing>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</object>
- <packing>
- <property name="position">2</property>
- </packing>
</child>
</object>
- <packing>
- <property name="position">1</property>
- </packing>
+ </child>
+ <child type="label">
+ <object class="GtkLabel" id="label54">
+ <property name="visible">True</property>
+ <property name="xpad">5</property>
+ <property name="label" translatable="yes"><b>Command</b></property>
+ <property name="use_markup">True</property>
+ </object>
</child>
</object>
<packing>
<property name="expand">False</property>
- <property name="padding">10</property>
- <property name="position">0</property>
+ <property name="position">1</property>
</packing>
</child>
</object>
@@ -592,35 +664,138 @@ Defining several profiles lets you have several commands, each applying with a d
</packing>
</child>
<child>
- <object class="GtkVBox" id="vbox9">
+ <object class="GtkVBox" id="vbox6">
<property name="visible">True</property>
- <property name="border_width">6</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <placeholder/>
+ </child>
<child>
- <object class="GtkVBox" id="vbox10">
+ <object class="GtkFrame" id="BackgroundToolbarFrame">
<property name="visible">True</property>
- <property name="spacing">10</property>
+ <property name="label_xalign">0</property>
+ <property name="shadow_type">in</property>
<child>
- <object class="GtkVBox" id="vbox11">
+ <object class="GtkAlignment" id="alignment6">
<property name="visible">True</property>
- <property name="spacing">10</property>
+ <property name="top_padding">6</property>
+ <property name="bottom_padding">6</property>
+ <property name="left_padding">12</property>
+ <property name="right_padding">6</property>
<child>
- <object class="GtkLabel" id="label16">
+ <object class="GtkTable" id="table4">
<property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes"><b>Appears if file matches</b></property>
- <property name="use_markup">True</property>
+ <property name="n_rows">2</property>
+ <property name="n_columns">2</property>
+ <property name="column_spacing">6</property>
+ <child>
+ <object class="GtkCheckButton" id="ToolbarSameLabelButton">
+ <property name="label" translatable="yes">Use _same label for icon in the toolbar</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 checked, the text besides the icon in the toolbar will be the same that those of the action itself.
+You shouldn't do this as text in toolbars should be really short.</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="ActionShortLabelLabel">
+ <property name="visible">True</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">S_hort label :</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="ToolbarLabelEntry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="tooltip_text" translatable="yes">Text which will be displayed in the toolbar besides of the icon.
+The actual display may depend of your Gnome preferences.</property>
+ <property name="max_length">32</property>
+ <property name="invisible_char">●</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</object>
- <packing>
- <property name="position">0</property>
- </packing>
</child>
+ </object>
+ </child>
+ <child type="label">
+ <object class="GtkLabel" id="label51">
+ <property name="visible">True</property>
+ <property name="xpad">5</property>
+ <property name="label" translatable="yes"><b>Nautilus toolbar</b></property>
+ <property name="use_markup">True</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child type="tab">
+ <object class="GtkLabel" id="label15">
+ <property name="visible">True</property>
+ <property name="tooltip_text" translatable="yes">This advanced tab lets you precisely choose on which schemes the selection will apply.</property>
+ <property name="label" translatable="yes">_Background</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="position">4</property>
+ <property name="tab_fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="vbox9">
+ <property name="visible">True</property>
+ <property name="border_width">6</property>
+ <property name="spacing">10</property>
+ <child>
+ <object class="GtkFrame" id="frame11">
+ <property name="visible">True</property>
+ <property name="label_xalign">0</property>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkAlignment" id="alignment11">
+ <property name="visible">True</property>
+ <property name="top_padding">6</property>
+ <property name="bottom_padding">6</property>
+ <property name="left_padding">12</property>
+ <property name="right_padding">6</property>
<child>
<object class="GtkTable" id="table3">
<property name="visible">True</property>
<property name="n_rows">3</property>
<property name="n_columns">2</property>
<property name="column_spacing">6</property>
- <property name="row_spacing">6</property>
+ <property name="row_spacing">3</property>
<child>
<object class="GtkLabel" id="ConditionsFilenamesLabel">
<property name="visible">True</property>
@@ -696,123 +871,131 @@ Defining several profiles lets you have several commands, each applying with a d
<placeholder/>
</child>
</object>
- <packing>
- <property name="position">1</property>
- </packing>
</child>
</object>
- <packing>
- <property name="position">0</property>
- </packing>
</child>
+ <child type="label">
+ <object class="GtkLabel" id="label10">
+ <property name="visible">True</property>
+ <property name="xpad">5</property>
+ <property name="label" translatable="yes"><b>Appears if file matches</b></property>
+ <property name="use_markup">True</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkFrame" id="frame12">
+ <property name="visible">True</property>
+ <property name="label_xalign">0</property>
+ <property name="shadow_type">in</property>
<child>
- <object class="GtkVBox" id="vbox12">
+ <object class="GtkAlignment" id="alignment12">
<property name="visible">True</property>
- <property name="spacing">10</property>
+ <property name="top_padding">6</property>
+ <property name="bottom_padding">6</property>
+ <property name="left_padding">12</property>
+ <property name="right_padding">6</property>
<child>
- <object class="GtkLabel" id="label19">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes"><b>Appears if selection contains</b></property>
- <property name="use_markup">True</property>
- </object>
- <packing>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkHBox" id="hbox4">
+ <object class="GtkVBox" id="vbox4">
<property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
<child>
- <object class="GtkRadioButton" id="ConditionsOnlyFilesButton">
- <property name="label" translatable="yes">Only _files</property>
+ <object class="GtkHBox" id="hbox4">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">If selected, item will appear in the Nautilus context menu if and only if the selection contains only files.</property>
- <property name="use_underline">True</property>
- <property name="xalign">0</property>
- <property name="active">True</property>
- <property name="draw_indicator">True</property>
+ <child>
+ <object class="GtkRadioButton" id="ConditionsOnlyFilesButton">
+ <property name="label" translatable="yes">Only _files</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="tooltip_text" translatable="yes">If selected, item will appear in the Nautilus context menu if and only if the selection contains only files.</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkRadioButton" id="ConditionsOnlyFoldersButton">
+ <property name="label" translatable="yes">Only f_olders</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="tooltip_text" translatable="yes">If selected, item will appear in the Nautilus context menu if and only if the selection contains only folders.</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">ConditionsOnlyFilesButton</property>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkRadioButton" id="ConditionsBothButton">
+ <property name="label" translatable="yes">_Both</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="tooltip_text" translatable="yes">If selected, item will always appear in the Nautilus context menu.</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">ConditionsOnlyFilesButton</property>
+ </object>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="position">0</property>
</packing>
</child>
<child>
- <object class="GtkRadioButton" id="ConditionsOnlyFoldersButton">
- <property name="label" translatable="yes">Only f_olders</property>
+ <object class="GtkCheckButton" id="ConditionsMultipleButton">
+ <property name="label" translatable="yes">Appears if selection has m_ultiple files or folders</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">If selected, item will appear in the Nautilus context menu if and only if the selection contains only folders.</property>
+ <property name="tooltip_text" translatable="yes">If selected, item will always appear in the Nautilus context menu. Else it will appear if and only if the selection contains only one file or folder.</property>
<property name="use_underline">True</property>
- <property name="xalign">0</property>
<property name="draw_indicator">True</property>
- <property name="group">ConditionsOnlyFilesButton</property>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
- <child>
- <object class="GtkRadioButton" id="ConditionsBothButton">
- <property name="label" translatable="yes">_Both</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">If selected, item will always appear in the Nautilus context menu.</property>
- <property name="use_underline">True</property>
- <property name="xalign">0</property>
- <property name="draw_indicator">True</property>
- <property name="group">ConditionsOnlyFilesButton</property>
- </object>
- <packing>
- <property name="position">2</property>
- </packing>
- </child>
</object>
- <packing>
- <property name="position">1</property>
- </packing>
</child>
</object>
- <packing>
- <property name="position">1</property>
- </packing>
</child>
- <child>
- <object class="GtkVBox" id="vbox13">
+ <child type="label">
+ <object class="GtkLabel" id="label12">
<property name="visible">True</property>
- <child>
- <object class="GtkCheckButton" id="ConditionsMultipleButton">
- <property name="label" translatable="yes">Appears if selection has m_ultiple files or folders</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">If selected, item will always appear in the Nautilus context menu. Else it will appear if and only if the selection contains only one file or folder.</property>
- <property name="use_underline">True</property>
- <property name="draw_indicator">True</property>
- </object>
- <packing>
- <property name="position">0</property>
- </packing>
- </child>
+ <property name="xpad">5</property>
+ <property name="label" translatable="yes"><b>Appears if selection contains</b></property>
+ <property name="use_markup">True</property>
</object>
- <packing>
- <property name="position">2</property>
- </packing>
</child>
</object>
<packing>
<property name="expand">False</property>
- <property name="padding">10</property>
- <property name="position">0</property>
+ <property name="position">1</property>
</packing>
</child>
</object>
<packing>
- <property name="position">2</property>
+ <property name="position">3</property>
</packing>
</child>
<child type="tab">
@@ -823,7 +1006,7 @@ Defining several profiles lets you have several commands, each applying with a d
<property name="use_underline">True</property>
</object>
<packing>
- <property name="position">2</property>
+ <property name="position">3</property>
<property name="tab_fill">False</property>
</packing>
</child>
@@ -938,18 +1121,18 @@ Defining several profiles lets you have several commands, each applying with a d
</child>
</object>
<packing>
- <property name="position">3</property>
+ <property name="position">4</property>
</packing>
</child>
<child type="tab">
- <object class="GtkLabel" id="label15">
+ <object class="GtkLabel" id="label50">
<property name="visible">True</property>
<property name="tooltip_text" translatable="yes">This advanced tab lets you precisely choose on which schemes the selection will apply.</property>
<property name="label" translatable="yes">A_dvanced conditions</property>
<property name="use_underline">True</property>
</object>
<packing>
- <property name="position">3</property>
+ <property name="position">4</property>
<property name="tab_fill">False</property>
</packing>
</child>
@@ -982,21 +1165,6 @@ Defining several profiles lets you have several commands, each applying with a d
</object>
</child>
</object>
- <object class="GtkImage" id="image3">
- <property name="visible">True</property>
- <property name="stock">gtk-find-and-replace</property>
- <property name="icon-size">4</property>
- </object>
- <object class="GtkImage" id="image2">
- <property name="visible">True</property>
- <property name="stock">gtk-find-and-replace</property>
- <property name="icon-size">4</property>
- </object>
- <object class="GtkImage" id="image1">
- <property name="visible">True</property>
- <property name="stock">gtk-help</property>
- <property name="icon-size">4</property>
- </object>
<object class="GtkAssistant" id="ImportAssistant">
<property name="border_width">12</property>
<property name="title" translatable="yes">Importing actions</property>
@@ -1018,9 +1186,9 @@ Defining several profiles lets you have several commands, each applying with a d
<object class="GtkFileChooserWidget" id="ImportFileChooser">
<property name="visible">True</property>
<property name="select_multiple">True</property>
- <property name="preview_widget_active">False</property>
<property name="local_only">False</property>
<property name="use_preview_label">False</property>
+ <property name="preview_widget_active">False</property>
</object>
<packing>
<property name="position">0</property>
@@ -1727,7 +1895,7 @@ Be warned: this mode may be dangerous. You will not be prompted another time.</p
<child type="label">
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
- <property name="xpad">4</property>
+ <property name="xpad">5</property>
<property name="label" translatable="yes"><b>Items ordering</b></property>
<property name="use_markup">True</property>
</object>
@@ -1795,7 +1963,7 @@ Be warned: this mode may be dangerous. You will not be prompted another time.</p
<child type="label">
<object class="GtkLabel" id="label41">
<property name="visible">True</property>
- <property name="xpad">4</property>
+ <property name="xpad">5</property>
<property name="label" translatable="yes"><b>Nautilus menu layout</b></property>
<property name="use_markup">True</property>
</object>
@@ -1910,7 +2078,7 @@ Be warned: this mode may be dangerous. You will not be prompted another time.</p
<child type="label">
<object class="GtkLabel" id="label42">
<property name="visible">True</property>
- <property name="xpad">4</property>
+ <property name="xpad">5</property>
<property name="label" translatable="yes"><b>Relabeling items</b></property>
<property name="use_markup">True</property>
</object>
@@ -2030,7 +2198,7 @@ Be warned: this mode may be dangerous. You will not be prompted another time.</p
<child type="label">
<object class="GtkLabel" id="label44">
<property name="visible">True</property>
- <property name="xpad">4</property>
+ <property name="xpad">5</property>
<property name="label" translatable="yes"><b>Import mode</b></property>
<property name="use_markup">True</property>
</object>
@@ -2064,7 +2232,6 @@ Be warned: this mode may be dangerous. You will not be prompted another time.</p
<child>
<object class="GtkVBox" id="vbox41">
<property name="visible">True</property>
- <property name="orientation">vertical</property>
<child>
<object class="GtkFrame" id="frame5">
<property name="visible">True</property>
@@ -2079,7 +2246,6 @@ Be warned: this mode may be dangerous. You will not be prompted another time.</p
<object class="GtkVBox" id="vbox42">
<property name="visible">True</property>
<property name="border_width">6</property>
- <property name="orientation">vertical</property>
<property name="homogeneous">True</property>
<child>
<object class="GtkRadioButton" id="PrefsNoImportButton1">
@@ -2144,7 +2310,7 @@ Be warned: this mode may be dangerous. You will not be prompted another time.</p
<child type="label">
<object class="GtkLabel" id="label49">
<property name="visible">True</property>
- <property name="xpad">4</property>
+ <property name="xpad">5</property>
<property name="label" translatable="yes"><b>Export mode</b></property>
<property name="use_markup">True</property>
</object>
@@ -2408,18 +2574,32 @@ Be warned: this mode may be dangerous. You will not be prompted another time.</p
<action-widget response="0">OKButton1</action-widget>
</action-widgets>
</object>
+ <object class="GtkImage" id="image3">
+ <property name="visible">True</property>
+ <property name="stock">gtk-find-and-replace</property>
+ <property name="icon-size">4</property>
+ </object>
+ <object class="GtkImage" id="image2">
+ <property name="visible">True</property>
+ <property name="stock">gtk-find-and-replace</property>
+ <property name="icon-size">4</property>
+ </object>
+ <object class="GtkImage" id="image1">
+ <property name="visible">True</property>
+ <property name="stock">gtk-help</property>
+ <property name="icon-size">4</property>
+ </object>
<object class="GtkSizeGroup" id="CommandLabelSizeGroup">
<widgets>
- <widget name="ProfileLabelLabel"/>
- <widget name="CommandPathLabel"/>
<widget name="CommandParametersLabel"/>
- <widget name="CommandExamplePreLabel"/>
+ <widget name="CommandPathLabel"/>
+ <widget name="ProfileLabelLabel"/>
</widgets>
</object>
<object class="GtkSizeGroup" id="CommandButtonSizeGroup">
<widgets>
- <widget name="CommandPathButton"/>
<widget name="CommandLegendButton"/>
+ <widget name="CommandPathButton"/>
</widgets>
</object>
</interface>
diff --git a/src/plugin/nautilus-actions.c b/src/plugin/nautilus-actions.c
index 45697db..0fe336b 100644
--- a/src/plugin/nautilus-actions.c
+++ b/src/plugin/nautilus-actions.c
@@ -72,9 +72,10 @@ static void instance_finalize( GObject *object );
static GList *get_background_items( NautilusMenuProvider *provider, GtkWidget *window, NautilusFileInfo *current_folder );
static GList *get_file_items( NautilusMenuProvider *provider, GtkWidget *window, GList *files );
-static GList *build_nautilus_menus( NautilusActions *plugin, GList *tree, GList *files );
-static NAObjectProfile *is_action_candidate( NautilusActions *plugin, NAObjectAction *action, GList *files );
-static NautilusMenuItem *create_item_from_profile( NAObjectProfile *profile, GList *files );
+static GList *get_toolbar_items( NautilusMenuProvider *provider, GtkWidget *window, NautilusFileInfo *current_folder );
+static GList *build_nautilus_menus( NautilusActions *plugin, GList *tree, gint target, GList *files );
+static NAObjectProfile *is_action_candidate( NautilusActions *plugin, NAObjectAction *action, gint target, GList *files );
+static NautilusMenuItem *create_item_from_profile( NAObjectProfile *profile, gint target, GList *files );
static NautilusMenuItem *create_item_from_menu( NAObjectMenu *menu, GList *subitems );
static NautilusMenuItem *create_menu_item( NAObjectItem *item );
static void attach_submenu_to_item( NautilusMenuItem *item, GList *subitems );
@@ -171,6 +172,7 @@ menu_provider_iface_init( NautilusMenuProviderIface *iface )
iface->get_file_items = get_file_items;
iface->get_background_items = get_background_items;
+ iface->get_toolbar_items = get_toolbar_items;
}
static void
@@ -280,24 +282,42 @@ static void nautilus_menu_provider_emit_items_updated_signal (NautilusMenuProvid
/*
* this function is called when nautilus has to paint a folder background
* one of the first calls is with current_folder = 'x-nautilus-desktop:///'
- * we have nothing to do here ; the function is left as a placeholder
- * (and as an historic remainder)
- * .../...
- * until we have some actions defined as specific to backgrounds !
+ * the menu items are available :
+ * a) in File menu
+ * b) in contextual menu of the folder if there is no current selection
*/
static GList *
get_background_items( NautilusMenuProvider *provider, GtkWidget *window, NautilusFileInfo *current_folder )
{
-#ifdef NA_MAINTAINER_MODE
static const gchar *thisfn = "nautilus_actions_get_background_items";
- gchar *uri = nautilus_file_info_get_uri( current_folder );
- g_debug( "%s: provider=%p, window=%p, current_folder=%p (%s)",
- thisfn, ( void * ) provider, ( void * ) window, ( void * ) current_folder, uri );
- g_free( uri );
-#endif
- return(( GList * ) NULL );
+ GList *nautilus_menus_list = NULL;
+ gchar *uri;
+ GList *files;
+ GList *pivot_tree;
+
+ if( !NAUTILUS_ACTIONS( provider )->private->dispose_has_run ){
+
+ uri = nautilus_file_info_get_uri( current_folder );
+ g_debug( "%s: provider=%p, window=%p, current_folder=%p (%s)",
+ thisfn, ( void * ) provider, ( void * ) window, ( void * ) current_folder, uri );
+ g_free( uri );
+
+ files = g_list_prepend( NULL, current_folder );
+ pivot_tree = na_pivot_get_items( NAUTILUS_ACTIONS( provider )->private->pivot );
+ nautilus_menus_list = build_nautilus_menus(
+ NAUTILUS_ACTIONS( provider ), pivot_tree, ITEM_TARGET_BACKGROUND, files );
+ g_list_free( files );
+ }
+
+ return( nautilus_menus_list );
}
+/*
+ * this function is called each time the selection changed
+ * menus items are available :
+ * a) in Edit menu while the selection stays unchanged
+ * b) in contextual menu while the selection stays unchanged
+ */
static GList *
get_file_items( NautilusMenuProvider *provider, GtkWidget *window, GList *files )
{
@@ -327,8 +347,9 @@ get_file_items( NautilusMenuProvider *provider, GtkWidget *window, GList *files
pivot_tree = na_pivot_get_items( self->private->pivot );
- nautilus_menus_list = build_nautilus_menus( self, pivot_tree, files );
- g_debug( "%s: menus has %d level zero items", thisfn, g_list_length( nautilus_menus_list ));
+ nautilus_menus_list = build_nautilus_menus(
+ self, pivot_tree, ITEM_TARGET_SELECTION, files );
+ /*g_debug( "%s: menus has %d level zero items", thisfn, g_list_length( nautilus_menus_list ));*/
root_menu = na_iprefs_should_create_root_menu( NA_IPREFS( self->private->pivot ));
if( root_menu ){
@@ -336,7 +357,7 @@ get_file_items( NautilusMenuProvider *provider, GtkWidget *window, GList *files
}
add_about = na_iprefs_should_add_about_item( NA_IPREFS( self->private->pivot ));
- g_debug( "%s: add_about=%s", thisfn, add_about ? "True":"False" );
+ /*g_debug( "%s: add_about=%s", thisfn, add_about ? "True":"False" );*/
if( add_about ){
nautilus_menus_list = add_about_item( self, nautilus_menus_list );
}
@@ -345,19 +366,53 @@ get_file_items( NautilusMenuProvider *provider, GtkWidget *window, GList *files
return( nautilus_menus_list );
}
+/*
+ * as of 2.26, this function is only called for folders, but for the
+ * desktop (x-nautilus-desktop:///) which seems to be only called by
+ * get_background_items ; also, only actions (not menus) are displayed
+ */
static GList *
-build_nautilus_menus( NautilusActions *plugin, GList *tree, GList *files )
+get_toolbar_items( NautilusMenuProvider *provider, GtkWidget *window, NautilusFileInfo *current_folder )
{
- static const gchar *thisfn = "nautilus_actions_build_nautilus_menus";
+ static const gchar *thisfn = "nautilus_actions_get_toolbar_items";
+ GList *nautilus_menus_list = NULL;
+ gchar *uri;
+ GList *files;
+ GList *pivot_tree;
+
+ uri = nautilus_file_info_get_uri( current_folder );
+ g_debug( "%s: provider=%p, window=%p, current_folder=%p (%s)",
+ thisfn, ( void * ) provider, ( void * ) window, ( void * ) current_folder, uri );
+ g_free( uri );
+
+ if( !NAUTILUS_ACTIONS( provider )->private->dispose_has_run ){
+
+ files = g_list_prepend( NULL, current_folder );
+ pivot_tree = na_pivot_get_items( NAUTILUS_ACTIONS( provider )->private->pivot );
+ nautilus_menus_list = build_nautilus_menus(
+ NAUTILUS_ACTIONS( provider ), pivot_tree, ITEM_TARGET_TOOLBAR, files );
+ g_list_free( files );
+ }
+
+ return( nautilus_menus_list );
+}
+
+/*
+ * when building a menu for the toolbar, do not use menus hierarchy
+ */
+static GList *
+build_nautilus_menus( NautilusActions *plugin, GList *tree, gint target, GList *files )
+{
+ static const gchar *thisfn = "nautilus_actions_build_file_selection_menus";
GList *menus_list = NULL;
GList *subitems, *submenu;
GList *it;
NAObjectProfile *profile;
NautilusMenuItem *item;
- gchar *label;
- g_debug( "%s: plugin=%p, tree=%p, files=%p",
- thisfn, ( void * ) plugin, ( void * ) tree, ( void * ) files );
+ g_debug( "%s: plugin=%p, tree=%p, target=%d, files=%p (count=%d)",
+ thisfn, ( void * ) plugin, ( void * ) tree, target,
+ ( void * ) files, g_list_length( files ));
for( it = tree ; it ; it = it->next ){
@@ -368,26 +423,26 @@ build_nautilus_menus( NautilusActions *plugin, GList *tree, GList *files )
continue;
}
- label = na_object_get_label( it->data );
- g_debug( "%s: %s - %s", thisfn, G_OBJECT_TYPE_NAME( it->data ), label );
- g_free( label );
-
if( NA_IS_OBJECT_MENU( it->data )){
subitems = na_object_get_items_list( it->data );
- submenu = build_nautilus_menus( plugin, subitems, files );
+ submenu = build_nautilus_menus( plugin, subitems, target, files );
/*g_debug( "%s: submenu has %d items", thisfn, g_list_length( submenu ));*/
if( submenu ){
- item = create_item_from_menu( NA_OBJECT_MENU( it->data ), submenu );
- menus_list = g_list_append( menus_list, item );
+ if( target != ITEM_TARGET_TOOLBAR ){
+ item = create_item_from_menu( NA_OBJECT_MENU( it->data ), submenu );
+ menus_list = g_list_append( menus_list, item );
+ } else {
+ menus_list = g_list_concat( menus_list, submenu );
+ }
}
continue;
}
g_return_val_if_fail( NA_IS_OBJECT_ACTION( it->data ), NULL );
- profile = is_action_candidate( plugin, NA_OBJECT_ACTION( it->data ), files );
+ profile = is_action_candidate( plugin, NA_OBJECT_ACTION( it->data ), target, files );
if( profile ){
- item = create_item_from_profile( profile, files );
+ item = create_item_from_profile( profile, target, files );
menus_list = g_list_append( menus_list, item );
}
}
@@ -399,7 +454,7 @@ build_nautilus_menus( NautilusActions *plugin, GList *tree, GList *files )
* could also be a NAObjectAction method - but this is not used elsewhere
*/
static NAObjectProfile *
-is_action_candidate( NautilusActions *plugin, NAObjectAction *action, GList *files )
+is_action_candidate( NautilusActions *plugin, NAObjectAction *action, gint target, GList *files )
{
static const gchar *thisfn = "nautilus_actions_is_action_candidate";
NAObjectProfile *candidate = NULL;
@@ -420,7 +475,7 @@ is_action_candidate( NautilusActions *plugin, NAObjectAction *action, GList *fil
for( ip = profiles ; ip && !candidate ; ip = ip->next ){
NAObjectProfile *profile = NA_OBJECT_PROFILE( ip->data );
- if( na_object_profile_is_candidate( profile, files )){
+ if( na_object_profile_is_candidate( profile, target, files )){
profile_label = na_object_get_label( profile );
g_debug( "%s: selecting %s - %s", thisfn, action_label, profile_label );
@@ -436,7 +491,7 @@ is_action_candidate( NautilusActions *plugin, NAObjectAction *action, GList *fil
}
static NautilusMenuItem *
-create_item_from_profile( NAObjectProfile *profile, GList *files )
+create_item_from_profile( NAObjectProfile *profile, gint target, GList *files )
{
NautilusMenuItem *item;
NAObjectAction *action;
@@ -456,10 +511,14 @@ create_item_from_profile( NAObjectProfile *profile, GList *files )
0 );
g_object_set_data_full( G_OBJECT( item ),
- "files",
+ "nautilus-actions-files",
nautilus_file_info_list_copy( files ),
( GDestroyNotify ) nautilus_file_info_list_free );
+ g_object_set_data( G_OBJECT( item ),
+ "nautilus-actions-target",
+ GINT_TO_POINTER( target ));
+
return( item );
}
@@ -526,15 +585,17 @@ execute_action( NautilusMenuItem *item, NAObjectProfile *profile )
GList *files;
GString *cmd;
gchar *param, *path;
+ gint target;
g_debug( "%s: item=%p, profile=%p", thisfn, ( void * ) item, ( void * ) profile );
- files = ( GList* ) g_object_get_data( G_OBJECT( item ), "files" );
+ files = ( GList * ) g_object_get_data( G_OBJECT( item ), "nautilus-actions-files" );
+ target = GPOINTER_TO_INT( g_object_get_data( G_OBJECT( item ), "nautilus-actions-target" ));
path = na_object_profile_get_path( profile );
cmd = g_string_new( path );
- param = na_object_profile_parse_parameters( profile, files );
+ param = na_object_profile_parse_parameters( profile, target, files );
if( param != NULL ){
g_string_append_printf( cmd, " %s", param );
diff --git a/src/runtime/na-gconf-provider-keys.h b/src/runtime/na-gconf-provider-keys.h
index 0561a6f..54fc3bb 100644
--- a/src/runtime/na-gconf-provider-keys.h
+++ b/src/runtime/na-gconf-provider-keys.h
@@ -39,12 +39,17 @@
/* GConf key names (common to menu and actions)
*/
-#define OBJECT_ITEM_LABEL_ENTRY "label"
-#define OBJECT_ITEM_TOOLTIP_ENTRY "tooltip"
-#define OBJECT_ITEM_ICON_ENTRY "icon"
-#define OBJECT_ITEM_ENABLED_ENTRY "enabled"
-#define OBJECT_ITEM_LIST_ENTRY "items"
-#define OBJECT_ITEM_TYPE_ENTRY "type"
+#define OBJECT_ITEM_LABEL_ENTRY "label"
+#define OBJECT_ITEM_TOOLTIP_ENTRY "tooltip"
+#define OBJECT_ITEM_ICON_ENTRY "icon"
+#define OBJECT_ITEM_ENABLED_ENTRY "enabled"
+#define OBJECT_ITEM_LIST_ENTRY "items"
+#define OBJECT_ITEM_TYPE_ENTRY "type"
+#define OBJECT_ITEM_TARGET_SELECTION_ENTRY "target-selection"
+#define OBJECT_ITEM_TARGET_BACKGROUND_ENTRY "target-background"
+#define OBJECT_ITEM_TARGET_TOOLBAR_ENTRY "target-toolbar"
+#define OBJECT_ITEM_TOOLBAR_SAME_LABEL_ENTRY "toolbar-same-label"
+#define OBJECT_ITEM_TOOLBAR_LABEL_ENTRY "toolbar-label"
#define OBJECT_ITEM_TYPE_MENU "Menu"
#define OBJECT_ITEM_TYPE_ACTION "Action"
@@ -68,5 +73,6 @@
#define ACTION_ISDIR_ENTRY "isdir"
#define ACTION_MULTIPLE_ENTRY "accept-multiple-files"
#define ACTION_SCHEMES_ENTRY "schemes"
+#define ACTION_FOLDERS_ENTRY "folders"
#endif /* __NA_RUNTIME_GCONF_PROVIDER_KEYS_H__ */
diff --git a/src/runtime/na-gconf-provider.c b/src/runtime/na-gconf-provider.c
index 12ae90f..d45dc30 100644
--- a/src/runtime/na-gconf-provider.c
+++ b/src/runtime/na-gconf-provider.c
@@ -585,6 +585,8 @@ static void
read_item_action_properties( NAGConfProvider *provider, GSList *entries, NAObjectAction *action )
{
gchar *version;
+ gboolean toolbar_same_label;
+ gchar *toolbar_label;
read_object_item_properties( provider, entries, NA_OBJECT_ITEM( action ) );
@@ -592,6 +594,15 @@ read_item_action_properties( NAGConfProvider *provider, GSList *entries, NAObjec
na_object_action_set_version( action, version );
g_free( version );
}
+
+ if( na_gconf_utils_get_bool_from_entries( entries, OBJECT_ITEM_TOOLBAR_SAME_LABEL_ENTRY, &toolbar_same_label )){
+ na_object_action_toolbar_set_same_label( action, toolbar_same_label );
+ }
+
+ if( na_gconf_utils_get_string_from_entries( entries, OBJECT_ITEM_TOOLBAR_LABEL_ENTRY, &toolbar_label )){
+ na_object_action_toolbar_set_label( action, toolbar_label );
+ g_free( toolbar_label );
+ }
}
/*
@@ -639,6 +650,7 @@ read_item_action_profile_properties( NAGConfProvider *provider, GSList *entries,
gchar *label, *path, *parameters;
GSList *basenames, *schemes, *mimetypes;
gboolean isfile, isdir, multiple, matchcase;
+ GSList *folders;
if( na_gconf_utils_get_string_from_entries( entries, ACTION_PROFILE_LABEL_ENTRY, &label )){
na_object_set_label( profile, label );
@@ -689,6 +701,11 @@ read_item_action_profile_properties( NAGConfProvider *provider, GSList *entries,
na_object_profile_set_mimetypes( profile, mimetypes );
na_utils_free_string_list( mimetypes );
}
+
+ if( na_gconf_utils_get_string_list_from_entries( entries, ACTION_FOLDERS_ENTRY, &folders )){
+ na_object_profile_set_folders( profile, folders );
+ na_utils_free_string_list( folders );
+ }
}
static void
@@ -727,6 +744,7 @@ read_object_item_properties( NAGConfProvider *provider, GSList *entries, NAObjec
gchar *id, *label, *tooltip, *icon;
gboolean enabled;
GSList *subitems;
+ gboolean target_selection, target_background, target_toolbar;
if( !na_gconf_utils_get_string_from_entries( entries, OBJECT_ITEM_LABEL_ENTRY, &label )){
id = na_object_get_id( item );
@@ -755,6 +773,18 @@ read_object_item_properties( NAGConfProvider *provider, GSList *entries, NAObjec
na_object_item_set_items_string_list( item, subitems );
na_utils_free_string_list( subitems );
}
+
+ if( na_gconf_utils_get_bool_from_entries( entries, OBJECT_ITEM_TARGET_SELECTION_ENTRY, &target_selection )){
+ na_object_set_target_selection( item, target_selection );
+ }
+
+ if( na_gconf_utils_get_bool_from_entries( entries, OBJECT_ITEM_TARGET_BACKGROUND_ENTRY, &target_background )){
+ na_object_set_target_background( item, target_background );
+ }
+
+ if( na_gconf_utils_get_bool_from_entries( entries, OBJECT_ITEM_TARGET_TOOLBAR_ENTRY, &target_toolbar )){
+ na_object_set_target_toolbar( item, target_toolbar );
+ }
}
static gboolean
@@ -849,6 +879,8 @@ write_item_action( NAGConfProvider *provider, const NAObjectAction *action, gcha
ret =
write_object_item( provider, NA_OBJECT_ITEM( action ), message ) &&
write_str( provider, uuid, NULL, ACTION_VERSION_ENTRY, na_object_action_get_version( action ), message ) &&
+ write_bool( provider, uuid, NULL, OBJECT_ITEM_TOOLBAR_SAME_LABEL_ENTRY, na_object_action_toolbar_use_same_label( action ), message ) &&
+ write_str( provider, uuid, NULL, OBJECT_ITEM_TOOLBAR_LABEL_ENTRY, na_object_action_toolbar_get_label( action ), message ) &&
write_str( provider, uuid, NULL, OBJECT_ITEM_TYPE_ENTRY, g_strdup( OBJECT_ITEM_TYPE_ACTION ), message );
profiles = na_object_get_items_list( action );
@@ -868,7 +900,8 @@ write_item_action( NAGConfProvider *provider, const NAObjectAction *action, gcha
write_bool( provider, uuid, name, ACTION_ISFILE_ENTRY, na_object_profile_get_is_file( profile ), message ) &&
write_bool( provider, uuid, name, ACTION_ISDIR_ENTRY, na_object_profile_get_is_dir( profile ), message ) &&
write_bool( provider, uuid, name, ACTION_MULTIPLE_ENTRY, na_object_profile_get_multiple( profile ), message ) &&
- write_list( provider, uuid, name, ACTION_SCHEMES_ENTRY, na_object_profile_get_schemes( profile ), message );
+ write_list( provider, uuid, name, ACTION_SCHEMES_ENTRY, na_object_profile_get_schemes( profile ), message ) &&
+ write_list( provider, uuid, name, ACTION_FOLDERS_ENTRY, na_object_profile_get_folders( profile ), message );
g_free( name );
}
@@ -908,6 +941,9 @@ write_object_item( NAGConfProvider *provider, const NAObjectItem *item, gchar **
write_str( provider, uuid, NULL, OBJECT_ITEM_TOOLTIP_ENTRY, na_object_get_tooltip( item ), message ) &&
write_str( provider, uuid, NULL, OBJECT_ITEM_ICON_ENTRY, na_object_get_icon( item ), message ) &&
write_bool( provider, uuid, NULL, OBJECT_ITEM_ENABLED_ENTRY, na_object_is_enabled( item ), message ) &&
+ write_bool( provider, uuid, NULL, OBJECT_ITEM_TARGET_SELECTION_ENTRY, na_object_is_target_selection( item ), message ) &&
+ write_bool( provider, uuid, NULL, OBJECT_ITEM_TARGET_BACKGROUND_ENTRY, na_object_is_target_background( item ), message ) &&
+ write_bool( provider, uuid, NULL, OBJECT_ITEM_TARGET_TOOLBAR_ENTRY, na_object_is_target_toolbar( item ), message ) &&
write_list( provider, uuid, NULL, OBJECT_ITEM_LIST_ENTRY, na_object_item_rebuild_items_list( item ), message );
g_free( uuid );
diff --git a/src/runtime/na-object-action-fn.h b/src/runtime/na-object-action-fn.h
index 7006eb1..738bb81 100644
--- a/src/runtime/na-object-action-fn.h
+++ b/src/runtime/na-object-action-fn.h
@@ -46,22 +46,28 @@ G_BEGIN_DECLS
/* #NAObjectAction properties
*/
-#define NAACTION_PROP_VERSION "na-action-version"
-#define NAACTION_PROP_READONLY "na-action-read-only"
-#define NAACTION_PROP_LAST_ALLOCATED "na-action-last-allocated"
+#define NAACTION_PROP_VERSION "na-action-version"
+#define NAACTION_PROP_READONLY "na-action-read-only"
+#define NAACTION_PROP_LAST_ALLOCATED "na-action-last-allocated"
+#define NAACTION_PROP_TOOLBAR_SAME_LABEL "na-action-toolbar-use-same-label"
+#define NAACTION_PROP_TOOLBAR_LABEL "na-action-toolbar-label"
/* i18n: default label for a newly created action */
-#define NA_OBJECT_ACTION_DEFAULT_LABEL _( "New Nautilus action" )
+#define NA_OBJECT_ACTION_DEFAULT_LABEL _( "New Nautilus action" )
-#define NAUTILUS_ACTIONS_CONFIG_VERSION "2.0"
+#define NAUTILUS_ACTIONS_CONFIG_VERSION "2.0"
NAObjectAction *na_object_action_new( void );
gchar *na_object_action_get_version( const NAObjectAction *action );
+gboolean na_object_action_toolbar_use_same_label( const NAObjectAction *action );
+gchar *na_object_action_toolbar_get_label( const NAObjectAction *action );
void na_object_action_set_version( NAObjectAction *action, const gchar *version );
void na_object_action_set_readonly( NAObjectAction *action, gboolean readonly );
+void na_object_action_toolbar_set_same_label( NAObjectAction *action, gboolean same_label );
+void na_object_action_toolbar_set_label( NAObjectAction *action, const gchar *label );
gchar *na_object_action_get_new_profile_name( const NAObjectAction *action );
void na_object_action_attach_profile( NAObjectAction *action, NAObjectProfile *profile );
diff --git a/src/runtime/na-object-action-priv.h b/src/runtime/na-object-action-priv.h
index 77bed3d..5378952 100644
--- a/src/runtime/na-object-action-priv.h
+++ b/src/runtime/na-object-action-priv.h
@@ -54,6 +54,13 @@ struct NAObjectActionPrivate {
* reset to zero when saving the action
*/
gint last_allocated;
+
+ /* toolbar display
+ * only for actions as of Nautilus-2.26
+ * note that 'use_same_label' is just a NACT preference
+ */
+ gboolean use_same_label;
+ gchar *toolbar_label;
};
G_END_DECLS
diff --git a/src/runtime/na-object-action.c b/src/runtime/na-object-action.c
index b692d83..0ca2948 100644
--- a/src/runtime/na-object-action.c
+++ b/src/runtime/na-object-action.c
@@ -50,7 +50,9 @@ struct NAObjectActionClassPrivate {
enum {
NAACTION_PROP_VERSION_ID = 1,
NAACTION_PROP_READONLY_ID,
- NAACTION_PROP_LAST_ALLOCATED_ID
+ NAACTION_PROP_LAST_ALLOCATED_ID,
+ NAACTION_PROP_TOOLBAR_SAME_LABEL_ID,
+ NAACTION_PROP_TOOLBAR_LABEL_ID
};
static NAObjectItemClass *st_parent_class = NULL;
@@ -68,6 +70,8 @@ static NAObject *object_new( const NAObject *action );
static void object_copy( NAObject *target, const NAObject *source );
static gboolean object_are_equal( const NAObject *a, const NAObject *b );
static gboolean object_is_valid( const NAObject *object );
+static gboolean is_valid_label( const NAObjectAction *action );
+static gboolean is_valid_short_label( const NAObjectAction *action );
GType
na_object_action_get_type( void )
@@ -142,6 +146,20 @@ class_init( NAObjectActionClass *klass )
G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE );
g_object_class_install_property( object_class, NAACTION_PROP_LAST_ALLOCATED_ID, spec );
+ spec = g_param_spec_boolean(
+ NAACTION_PROP_TOOLBAR_SAME_LABEL,
+ "Use same label",
+ "Whether the icon label in the toolbar is the same that the action main label", FALSE,
+ G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE );
+ g_object_class_install_property( object_class, NAACTION_PROP_TOOLBAR_SAME_LABEL_ID, spec );
+
+ spec = g_param_spec_string(
+ NAACTION_PROP_TOOLBAR_LABEL,
+ "Toolbar label",
+ "The label which is displayed besides of the icon in the Nautilus toolbar", "",
+ G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE );
+ g_object_class_install_property( object_class, NAACTION_PROP_TOOLBAR_LABEL_ID, spec );
+
klass->private = g_new0( NAObjectActionClassPrivate, 1 );
naobject_class = NA_OBJECT_CLASS( klass );
@@ -172,6 +190,8 @@ instance_init( GTypeInstance *instance, gpointer klass )
self->private->version = g_strdup( NAUTILUS_ACTIONS_CONFIG_VERSION );
self->private->read_only = FALSE;
self->private->last_allocated = 0;
+ self->private->use_same_label = FALSE;
+ self->private->toolbar_label = g_strdup( "" );
}
static void
@@ -197,6 +217,14 @@ instance_get_property( GObject *object, guint property_id, GValue *value, GParam
g_value_set_int( value, self->private->last_allocated );
break;
+ case NAACTION_PROP_TOOLBAR_SAME_LABEL_ID:
+ g_value_set_boolean( value, self->private->use_same_label );
+ break;
+
+ case NAACTION_PROP_TOOLBAR_LABEL_ID:
+ g_value_set_string( value, self->private->toolbar_label );
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID( object, property_id, spec );
break;
@@ -228,6 +256,15 @@ instance_set_property( GObject *object, guint property_id, const GValue *value,
self->private->last_allocated = g_value_get_int( value );
break;
+ case NAACTION_PROP_TOOLBAR_SAME_LABEL_ID:
+ self->private->use_same_label = g_value_get_boolean( value );
+ break;
+
+ case NAACTION_PROP_TOOLBAR_LABEL_ID:
+ g_free( self->private->toolbar_label );
+ self->private->toolbar_label = g_value_dup_string( value );
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID( object, property_id, spec );
break;
@@ -269,6 +306,7 @@ instance_finalize( GObject *object )
self = NA_OBJECT_ACTION( object );
g_free( self->private->version );
+ g_free( self->private->toolbar_label );
g_free( self->private );
@@ -330,6 +368,57 @@ na_object_action_get_version( const NAObjectAction *action )
}
/**
+ * na_object_action_toolbar_use_same_label:
+ * @action: the #NAObjectAction object to be requested.
+ *
+ * When displayed in the toolbar, does the specified @action use the
+ * same label that the main action label ?
+ *
+ * Returns: %TRUE if the label are sames, %FALSE else.
+ *
+ * Defaults to %FALSE because toolbar labels should really be smaller
+ * that those of menu items.
+ */
+gboolean
+na_object_action_toolbar_use_same_label( const NAObjectAction *action )
+{
+ gboolean use_same_label = FALSE;
+
+ g_return_val_if_fail( NA_IS_OBJECT_ACTION( action ), FALSE );
+
+ if( !action->private->dispose_has_run ){
+
+ g_object_get( G_OBJECT( action ), NAACTION_PROP_TOOLBAR_SAME_LABEL, &use_same_label, NULL );
+ }
+
+ return( use_same_label );
+}
+
+/**
+ * na_object_action_toolbar_get_label:
+ * @action: the #NAObjectAction object to be requested.
+ *
+ * Returns: the label which would be displayed besides of the icon in
+ * the Nautilus toolbar.
+ *
+ * The returned string should be g_free() by the caller.
+ */
+gchar *
+na_object_action_toolbar_get_label( const NAObjectAction *action )
+{
+ gchar *label = NULL;
+
+ g_return_val_if_fail( NA_IS_OBJECT_ACTION( action ), FALSE );
+
+ if( !action->private->dispose_has_run ){
+
+ g_object_get( G_OBJECT( action ), NAACTION_PROP_TOOLBAR_LABEL, &label, NULL );
+ }
+
+ return( label );
+}
+
+/**
* na_object_action_set_version:
* @action: the #NAObjectAction object to be updated.
* @label: the label to be set.
@@ -375,6 +464,48 @@ na_object_action_set_readonly( NAObjectAction *action, gboolean readonly )
}
/**
+ * na_object_action_toolbar_set_same_label:
+ * @action: the #NAObjectAction object to be updated.
+ * @use_same_label: whether the icon label is the same that the action label.
+ *
+ * Sets the new value.
+ *
+ * Please note that this value is only used in NACT user interface, which
+ * takes care of maintaining the main action label along with the toolbar
+ * item label.
+ *
+ * At runtime, we only ask for the toolbar item label.
+ */
+void
+na_object_action_toolbar_set_same_label( NAObjectAction *action, gboolean use_same_label )
+{
+ g_return_if_fail( NA_IS_OBJECT_ACTION( action ));
+
+ if( !action->private->dispose_has_run ){
+
+ g_object_set( G_OBJECT( action ), NAACTION_PROP_TOOLBAR_SAME_LABEL, use_same_label, NULL );
+ }
+}
+
+/**
+ * na_object_action_toolbar_set_label:
+ * @action: the #NAObjectAction object to be updated.
+ * @label: the label to be set.
+ *
+ * Sets the new value.
+ */
+void
+na_object_action_toolbar_set_label( NAObjectAction *action, const gchar *label )
+{
+ g_return_if_fail( NA_IS_OBJECT_ACTION( action ));
+
+ if( !action->private->dispose_has_run ){
+
+ g_object_set( G_OBJECT( action ), NAACTION_PROP_TOOLBAR_LABEL, label, NULL );
+ }
+}
+
+/**
* na_object_action_get_new_profile_name:
* @action: the #NAObjectAction object which will receive a new profile.
*
@@ -457,6 +588,8 @@ object_dump( const NAObject *action )
g_debug( "%s: version='%s'", thisfn, self->private->version );
g_debug( "%s: read-only='%s'", thisfn, self->private->read_only ? "True" : "False" );
g_debug( "%s: last-allocated=%d", thisfn, self->private->last_allocated );
+ g_debug( "%s: use-same-label='%s'", thisfn, self->private->use_same_label ? "True" : "False" );
+ g_debug( "%s: toolbar-label='%s'", thisfn, self->private->toolbar_label );
}
}
@@ -473,6 +606,8 @@ object_copy( NAObject *target, const NAObject *source )
gboolean readonly;
gint last_allocated;
GList *profiles, *ip;
+ gboolean toolbar_same_label;
+ gchar *toolbar_label;
g_return_if_fail( NA_IS_OBJECT_ACTION( target ));
g_return_if_fail( NA_IS_OBJECT_ACTION( source ));
@@ -484,12 +619,16 @@ object_copy( NAObject *target, const NAObject *source )
NAACTION_PROP_VERSION, &version,
NAACTION_PROP_READONLY, &readonly,
NAACTION_PROP_LAST_ALLOCATED, &last_allocated,
+ NAACTION_PROP_TOOLBAR_SAME_LABEL, &toolbar_same_label,
+ NAACTION_PROP_TOOLBAR_LABEL, &toolbar_label,
NULL );
g_object_set( G_OBJECT( target ),
NAACTION_PROP_VERSION, version,
NAACTION_PROP_READONLY, readonly,
NAACTION_PROP_LAST_ALLOCATED, last_allocated,
+ NAACTION_PROP_TOOLBAR_SAME_LABEL, toolbar_same_label,
+ NAACTION_PROP_TOOLBAR_LABEL, toolbar_label,
NULL );
g_free( version );
@@ -536,6 +675,16 @@ object_are_equal( const NAObject *a, const NAObject *b )
}
if( equal ){
+ equal = ( NA_OBJECT_ACTION( a )->private->use_same_label && NA_OBJECT_ACTION( b )->private->use_same_label ) ||
+ ( !NA_OBJECT_ACTION( a )->private->use_same_label && !NA_OBJECT_ACTION( b )->private->use_same_label );
+ }
+
+ if( equal ){
+ equal =
+ ( g_utf8_collate( NA_OBJECT_ACTION( a )->private->toolbar_label, NA_OBJECT_ACTION( b )->private->toolbar_label ) == 0 );
+ }
+
+ if( equal ){
profiles = na_object_get_items_list( a );
for( ip = profiles ; ip && equal ; ip = ip->next ){
id = na_object_get_id( ip->data );
@@ -573,7 +722,6 @@ object_are_equal( const NAObject *a, const NAObject *b )
gboolean
object_is_valid( const NAObject *action )
{
- gchar *label;
gboolean is_valid = TRUE;
GList *profiles, *ip;
gint valid_profiles;
@@ -582,10 +730,13 @@ object_is_valid( const NAObject *action )
if( !NA_OBJECT_ACTION( action )->private->dispose_has_run ){
- if( is_valid ){
- label = na_object_get_label( NA_OBJECT_ACTION( action ));
- is_valid = ( label && g_utf8_strlen( label, -1 ) > 0 );
- g_free( label );
+ if( na_object_is_target_toolbar( action )){
+ is_valid =
+ is_valid_short_label( NA_OBJECT_ACTION( action ));
+
+ } else {
+ is_valid =
+ is_valid_label( NA_OBJECT_ACTION( action ));
}
if( is_valid ){
@@ -602,3 +753,29 @@ object_is_valid( const NAObject *action )
return( is_valid );
}
+
+static gboolean
+is_valid_label( const NAObjectAction *action )
+{
+ gboolean is_valid;
+ gchar *label;
+
+ label = na_object_get_label( action );
+ is_valid = ( label && g_utf8_strlen( label, -1 ) > 0 );
+ g_free( label );
+
+ return( is_valid );
+}
+
+static gboolean
+is_valid_short_label( const NAObjectAction *action )
+{
+ gboolean is_valid;
+ gchar *label;
+
+ label = na_object_action_toolbar_get_label( action );
+ is_valid = ( label && g_utf8_strlen( label, -1 ) > 0 );
+ g_free( label );
+
+ return( is_valid );
+}
diff --git a/src/runtime/na-object-api.h b/src/runtime/na-object-api.h
index 1ea604f..a087530 100644
--- a/src/runtime/na-object-api.h
+++ b/src/runtime/na-object-api.h
@@ -92,12 +92,18 @@ G_BEGIN_DECLS
#define na_object_get_item( object, id ) na_object_item_get_item( NA_OBJECT_ITEM( object ), id )
#define na_object_get_items_list( object ) na_object_item_get_items_list( NA_OBJECT_ITEM( object ))
#define na_object_get_items_count( object ) na_object_item_get_items_count( NA_OBJECT_ITEM( object ))
+#define na_object_is_target_selection( object ) na_object_item_is_target_selection( NA_OBJECT_ITEM( object ))
+#define na_object_is_target_background( object ) na_object_item_is_target_background( NA_OBJECT_ITEM( object ))
+#define na_object_is_target_toolbar( object ) na_object_item_is_target_toolbar( NA_OBJECT_ITEM( object ))
#define na_object_set_tooltip( object, tooltip ) na_object_item_set_tooltip( NA_OBJECT_ITEM( object ), tooltip )
#define na_object_set_icon( object, icon ) na_object_item_set_icon( NA_OBJECT_ITEM( object ), icon )
#define na_object_set_provider( object, provider ) na_object_item_set_provider( NA_OBJECT_ITEM( object ), provider )
#define na_object_set_enabled( object, enabled ) na_object_item_set_enabled( NA_OBJECT_ITEM( object ), enabled )
#define na_object_set_items_list( object, list ) na_object_item_set_items_list( NA_OBJECT_ITEM( object ), list )
+#define na_object_set_target_selection( object, b ) na_object_item_set_target_selection( NA_OBJECT_ITEM( object ), b )
+#define na_object_set_target_background( object, b ) na_object_item_set_target_background( NA_OBJECT_ITEM( object ), b )
+#define na_object_set_target_toolbar( object, b ) na_object_item_set_target_toolbar( NA_OBJECT_ITEM( object ), b )
#define na_object_append_item( object, item ) na_object_item_append_item( NA_OBJECT_ITEM( object ), NA_OBJECT( item ))
#define na_object_remove_item( object, item ) na_object_item_remove_item( NA_OBJECT_ITEM( object ), NA_OBJECT( item ))
diff --git a/src/runtime/na-object-item-fn.h b/src/runtime/na-object-item-fn.h
index 5541ed6..3264f07 100644
--- a/src/runtime/na-object-item-fn.h
+++ b/src/runtime/na-object-item-fn.h
@@ -56,12 +56,18 @@ gboolean na_object_item_is_enabled( const NAObjectItem *item );
NAObject *na_object_item_get_item( const NAObjectItem *item, const gchar *id );
GList *na_object_item_get_items_list( const NAObjectItem *item );
guint na_object_item_get_items_count( const NAObjectItem *item );
+gboolean na_object_item_is_target_selection( const NAObjectItem *item );
+gboolean na_object_item_is_target_background( const NAObjectItem *item );
+gboolean na_object_item_is_target_toolbar( const NAObjectItem *item );
void na_object_item_set_tooltip( NAObjectItem *item, const gchar *tooltip );
void na_object_item_set_icon( NAObjectItem *item, const gchar *icon_name );
-void na_object_item_set_enabled( NAObjectItem *item, gboolean enabled );
void na_object_item_set_provider( NAObjectItem *item, const NAIIOProvider *provider );
+void na_object_item_set_enabled( NAObjectItem *item, gboolean enabled );
void na_object_item_set_items_list( NAObjectItem *item, GList *items );
+void na_object_item_set_target_selection( NAObjectItem *item, gboolean targeting );
+void na_object_item_set_target_background( NAObjectItem *item, gboolean targeting );
+void na_object_item_set_target_toolbar( NAObjectItem *item, gboolean targeting );
void na_object_item_append_item( NAObjectItem *object, const NAObject *item );
void na_object_item_remove_item( NAObjectItem *object, const NAObject *item );
diff --git a/src/runtime/na-object-item-priv.h b/src/runtime/na-object-item-priv.h
index e838bb5..4327f15 100644
--- a/src/runtime/na-object-item-priv.h
+++ b/src/runtime/na-object-item-priv.h
@@ -46,6 +46,14 @@ struct NAObjectItemPrivate {
gchar *icon;
gboolean enabled;
+ /* which targets does this item target ?
+ * note that targeting toolbar is (as of Nautilus 2.26) an
+ * action-only attribute
+ */
+ gboolean target_selection;
+ gboolean target_background;
+ gboolean target_toolbar;
+
/* list of NAObjectId subitems
*/
GList *items;
diff --git a/src/runtime/na-object-item.c b/src/runtime/na-object-item.c
index a59dc1c..4f81815 100644
--- a/src/runtime/na-object-item.c
+++ b/src/runtime/na-object-item.c
@@ -53,14 +53,20 @@ enum {
NAOBJECT_ITEM_PROP_ICON_ID,
NAOBJECT_ITEM_PROP_ENABLED_ID,
NAOBJECT_ITEM_PROP_PROVIDER_ID,
- NAOBJECT_ITEM_PROP_ITEMS_ID
+ NAOBJECT_ITEM_PROP_ITEMS_ID,
+ NAOBJECT_ITEM_PROP_TARGET_SELECTION_ID,
+ NAOBJECT_ITEM_PROP_TARGET_BACKGROUND_ID,
+ NAOBJECT_ITEM_PROP_TARGET_TOOLBAR_ID,
};
-#define NAOBJECT_ITEM_PROP_TOOLTIP "na-object-item-tooltip"
-#define NAOBJECT_ITEM_PROP_ICON "na-object-item-icon"
-#define NAOBJECT_ITEM_PROP_ENABLED "na-object-item-enabled"
-#define NAOBJECT_ITEM_PROP_PROVIDER "na-object-item-provider"
-#define NAOBJECT_ITEM_PROP_ITEMS "na-object-item-items"
+#define NAOBJECT_ITEM_PROP_TOOLTIP "na-object-item-tooltip"
+#define NAOBJECT_ITEM_PROP_ICON "na-object-item-icon"
+#define NAOBJECT_ITEM_PROP_ENABLED "na-object-item-enabled"
+#define NAOBJECT_ITEM_PROP_PROVIDER "na-object-item-provider"
+#define NAOBJECT_ITEM_PROP_ITEMS "na-object-item-items"
+#define NAOBJECT_ITEM_PROP_TARGET_SELECTION "na-object-item-target-selection"
+#define NAOBJECT_ITEM_PROP_TARGET_BACKGROUND "na-object-item-target-background"
+#define NAOBJECT_ITEM_PROP_TARGET_TOOLBAR "na-object-item-target-toolbar"
static NAObjectIdClass *st_parent_class = NULL;
@@ -163,6 +169,27 @@ class_init( NAObjectItemClass *klass )
G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE );
g_object_class_install_property( object_class, NAOBJECT_ITEM_PROP_PROVIDER_ID, spec );
+ spec = g_param_spec_boolean(
+ NAOBJECT_ITEM_PROP_TARGET_SELECTION,
+ "Target file selection",
+ "Whether the NAObjectItem is candidate on file selection menus", TRUE,
+ G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE );
+ g_object_class_install_property( object_class, NAOBJECT_ITEM_PROP_TARGET_SELECTION_ID, spec );
+
+ spec = g_param_spec_boolean(
+ NAOBJECT_ITEM_PROP_TARGET_BACKGROUND,
+ "Target background",
+ "Whether the NAObjectItem is candidate on background menus", FALSE,
+ G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE );
+ g_object_class_install_property( object_class, NAOBJECT_ITEM_PROP_TARGET_BACKGROUND_ID, spec );
+
+ spec = g_param_spec_boolean(
+ NAOBJECT_ITEM_PROP_TARGET_TOOLBAR,
+ "Target toolbar",
+ "Whether the NAObjectItem is candidate on toolbar display", TRUE,
+ G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE );
+ g_object_class_install_property( object_class, NAOBJECT_ITEM_PROP_TARGET_TOOLBAR_ID, spec );
+
klass->private = g_new0( NAObjectItemClassPrivate, 1 );
naobject_class = NA_OBJECT_CLASS( klass );
@@ -198,6 +225,9 @@ instance_init( GTypeInstance *instance, gpointer klass )
self->private->tooltip = g_strdup( "" );
self->private->icon = g_strdup( "" );
self->private->enabled = TRUE;
+ self->private->target_selection = TRUE;
+ self->private->target_background = FALSE;
+ self->private->target_toolbar = FALSE;
self->private->provider = NULL;
}
@@ -228,6 +258,18 @@ instance_get_property( GObject *object, guint property_id, GValue *value, GParam
g_value_set_pointer( value, self->private->provider );
break;
+ case NAOBJECT_ITEM_PROP_TARGET_SELECTION_ID:
+ g_value_set_boolean( value, self->private->target_selection );
+ break;
+
+ case NAOBJECT_ITEM_PROP_TARGET_BACKGROUND_ID:
+ g_value_set_boolean( value, self->private->target_background );
+ break;
+
+ case NAOBJECT_ITEM_PROP_TARGET_TOOLBAR_ID:
+ g_value_set_boolean( value, self->private->target_toolbar );
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID( object, property_id, spec );
break;
@@ -264,6 +306,18 @@ instance_set_property( GObject *object, guint property_id, const GValue *value,
self->private->provider = g_value_get_pointer( value );
break;
+ case NAOBJECT_ITEM_PROP_TARGET_SELECTION_ID:
+ self->private->target_selection = g_value_get_boolean( value );
+ break;
+
+ case NAOBJECT_ITEM_PROP_TARGET_BACKGROUND_ID:
+ self->private->target_background = g_value_get_boolean( value );
+ break;
+
+ case NAOBJECT_ITEM_PROP_TARGET_TOOLBAR_ID:
+ self->private->target_toolbar = g_value_get_boolean( value );
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID( object, property_id, spec );
break;
@@ -412,6 +466,30 @@ na_object_item_get_provider( const NAObjectItem *item )
}
/**
+ * na_object_item_is_enabled:
+ * @item: the #NAObjectItem object to be requested.
+ *
+ * Is the specified item enabled ?
+ * When disabled, the item, nor its subitems if any, is/are never
+ * candidate to any selection.
+ *
+ * Returns: %TRUE if the item is enabled, %FALSE else.
+ */
+gboolean
+na_object_item_is_enabled( const NAObjectItem *item )
+{
+ gboolean enabled = FALSE;
+
+ g_return_val_if_fail( NA_IS_OBJECT_ITEM( item ), FALSE );
+
+ if( !item->private->dispose_has_run ){
+ g_object_get( G_OBJECT( item ), NAOBJECT_ITEM_PROP_ENABLED, &enabled, NULL );
+ }
+
+ return( enabled );
+}
+
+/**
* na_object_item_get_item:
* @item: the #NAObjectItem from which we want retrieve a subitem.
* @id: the id of the searched subitem.
@@ -491,27 +569,77 @@ na_object_item_get_items_count( const NAObjectItem *item )
}
/**
- * na_object_item_is_enabled:
- * @item: the #NAObjectItem object to be requested.
+ * na_object_item_is_target_selection:
+ * @item: the #NAObjectItem to be requested.
*
- * Is the specified item enabled ?
- * When disabled, the item, nor its subitems if any, is/are never
- * candidate to any selection.
+ * Returns: %TRUE if @item is candidate for being displayed in file
+ * selection menus, %FALSE else.
*
- * Returns: %TRUE if the item is enabled, %FALSE else.
+ * This was the historical only target of Nautilus-Actions actions.
+ * It so defaults to %TRUE at object creation.
*/
gboolean
-na_object_item_is_enabled( const NAObjectItem *item )
+na_object_item_is_target_selection( const NAObjectItem *item )
{
- gboolean enabled = FALSE;
+ gboolean is_target = FALSE;
- g_return_val_if_fail( NA_IS_OBJECT_ITEM( item ), FALSE );
+ g_return_val_if_fail( NA_IS_OBJECT_ITEM( item ), 0 );
if( !item->private->dispose_has_run ){
- g_object_get( G_OBJECT( item ), NAOBJECT_ITEM_PROP_ENABLED, &enabled, NULL );
+
+ is_target = item->private->target_selection;
}
- return( enabled );
+ return( is_target );
+}
+
+/**
+ * na_object_item_is_target_background:
+ * @item: the #NAObjectItem to be requested.
+ *
+ * Returns: %TRUE if @item is candidate for being displayed in
+ * background menus, %FALSE else.
+ */
+gboolean
+na_object_item_is_target_background( const NAObjectItem *item )
+{
+ gboolean is_target = FALSE;
+
+ g_return_val_if_fail( NA_IS_OBJECT_ITEM( item ), 0 );
+
+ if( !item->private->dispose_has_run ){
+
+ is_target = item->private->target_background;
+ }
+
+ return( is_target );
+}
+
+/**
+ * na_object_item_is_target_toolbar:
+ * @item: the #NAObjectItem to be requested.
+ *
+ * Returns: %TRUE if @item is candidate for being displayed in file
+ * toolbar menus, %FALSE else.
+ *
+ * As of Nautilus 2.26, targeting toolbar is only available to the
+ * #NAObjectAction, as Nautilus doesn't care of displaying menus in
+ * its toolbar. Also, toolbar display uses same profile properties
+ * (folders) that background (cf. Nautilus API).
+ */
+gboolean
+na_object_item_is_target_toolbar( const NAObjectItem *item )
+{
+ gboolean is_target = FALSE;
+
+ g_return_val_if_fail( NA_IS_OBJECT_ITEM( item ), 0 );
+
+ if( !item->private->dispose_has_run ){
+
+ is_target = item->private->target_toolbar;
+ }
+
+ return( is_target );
}
/**
@@ -557,36 +685,36 @@ na_object_item_set_icon( NAObjectItem *item, const gchar *icon )
}
/**
- * na_object_item_set_enabled:
+ * na_object_item_set_provider:
* @item: the #NAObjectItem object to be updated.
- * @enabled: the indicator to be set.
+ * @provider: the #NAIIOProvider to be set.
*
- * Sets whether the item, and its subitems if any, is/are enabled or not.
+ * Sets the I/O provider for this #NAObjectItem.
*/
void
-na_object_item_set_enabled( NAObjectItem *item, gboolean enabled )
+na_object_item_set_provider( NAObjectItem *item, const NAIIOProvider *provider )
{
g_return_if_fail( NA_IS_OBJECT_ITEM( item ));
if( !item->private->dispose_has_run ){
- g_object_set( G_OBJECT( item ), NAOBJECT_ITEM_PROP_ENABLED, enabled, NULL );
+ g_object_set( G_OBJECT( item ), NAOBJECT_ITEM_PROP_PROVIDER, provider, NULL );
}
}
/**
- * na_object_item_set_provider:
+ * na_object_item_set_enabled:
* @item: the #NAObjectItem object to be updated.
- * @provider: the #NAIIOProvider to be set.
+ * @enabled: the indicator to be set.
*
- * Sets the I/O provider for this #NAObjectItem.
+ * Sets whether the item, and its subitems if any, is/are enabled or not.
*/
void
-na_object_item_set_provider( NAObjectItem *item, const NAIIOProvider *provider )
+na_object_item_set_enabled( NAObjectItem *item, gboolean enabled )
{
g_return_if_fail( NA_IS_OBJECT_ITEM( item ));
if( !item->private->dispose_has_run ){
- g_object_set( G_OBJECT( item ), NAOBJECT_ITEM_PROP_PROVIDER, provider, NULL );
+ g_object_set( G_OBJECT( item ), NAOBJECT_ITEM_PROP_ENABLED, enabled, NULL );
}
}
@@ -617,6 +745,60 @@ na_object_item_set_items_list( NAObjectItem *item, GList *items )
}
/**
+ * na_object_item_set_target_selection:
+ * @item: the #NAObjectItem to be updated.
+ * @targeting: whether @item targets selection menus.
+ *
+ * Set the flag for this target.
+ */
+void
+na_object_item_set_target_selection( NAObjectItem *item, gboolean targeting )
+{
+ g_return_if_fail( NA_IS_OBJECT_ITEM( item ));
+
+ if( !item->private->dispose_has_run ){
+
+ g_object_set( G_OBJECT( item ), NAOBJECT_ITEM_PROP_TARGET_SELECTION, targeting, NULL );
+ }
+}
+
+/**
+ * na_object_item_set_target_background:
+ * @item: the #NAObjectItem to be updated.
+ * @targeting: whether @item targets background menus.
+ *
+ * Set the flag for this target.
+ */
+void
+na_object_item_set_target_background( NAObjectItem *item, gboolean targeting )
+{
+ g_return_if_fail( NA_IS_OBJECT_ITEM( item ));
+
+ if( !item->private->dispose_has_run ){
+
+ g_object_set( G_OBJECT( item ), NAOBJECT_ITEM_PROP_TARGET_BACKGROUND, targeting, NULL );
+ }
+}
+
+/**
+ * na_object_item_set_target_toolbar:
+ * @item: the #NAObjectItem to be updated.
+ * @targeting: whether @item targets toolbar display.
+ *
+ * Set the flag for this target.
+ */
+void
+na_object_item_set_target_toolbar( NAObjectItem *item, gboolean targeting )
+{
+ g_return_if_fail( NA_IS_OBJECT_ITEM( item ));
+
+ if( !item->private->dispose_has_run ){
+
+ g_object_set( G_OBJECT( item ), NAOBJECT_ITEM_PROP_TARGET_TOOLBAR, targeting, NULL );
+ }
+}
+
+/**
* na_object_item_append_item:
* @item: the #NAObjectItem to which add the subitem.
* @object: a #NAObject to be added to list of subitems.
@@ -750,10 +932,13 @@ object_dump( const NAObject *item )
if( !NA_OBJECT_ITEM( item )->private->dispose_has_run ){
- g_debug( "%s: tooltip='%s'", thisfn, NA_OBJECT_ITEM( item )->private->tooltip );
- g_debug( "%s: icon='%s'", thisfn, NA_OBJECT_ITEM( item )->private->icon );
- g_debug( "%s: enabled='%s'", thisfn, NA_OBJECT_ITEM( item )->private->enabled ? "True" : "False" );
- g_debug( "%s: provider=%p", thisfn, ( void * ) NA_OBJECT_ITEM( item )->private->provider );
+ g_debug( "%s: tooltip='%s'", thisfn, NA_OBJECT_ITEM( item )->private->tooltip );
+ g_debug( "%s: icon='%s'", thisfn, NA_OBJECT_ITEM( item )->private->icon );
+ g_debug( "%s: enabled='%s'", thisfn, NA_OBJECT_ITEM( item )->private->enabled ? "True" : "False" );
+ g_debug( "%s: target-selection='%s'", thisfn, NA_OBJECT_ITEM( item )->private->target_selection ? "True" : "False" );
+ g_debug( "%s: target-background='%s'", thisfn, NA_OBJECT_ITEM( item )->private->target_background ? "True" : "False" );
+ g_debug( "%s: target-toolbar='%s'", thisfn, NA_OBJECT_ITEM( item )->private->target_toolbar ? "True" : "False" );
+ g_debug( "%s: provider=%p", thisfn, ( void * ) NA_OBJECT_ITEM( item )->private->provider );
/* dump subitems */
g_debug( "%s: %d subitem(s) at %p",
@@ -775,6 +960,7 @@ object_copy( NAObject *target, const NAObject *source )
gboolean enabled;
gpointer provider;
GList *subitems, *it;
+ gboolean target_selection, target_background, target_toolbar;
g_return_if_fail( NA_IS_OBJECT_ITEM( target ));
g_return_if_fail( NA_IS_OBJECT_ITEM( source ));
@@ -786,6 +972,9 @@ object_copy( NAObject *target, const NAObject *source )
NAOBJECT_ITEM_PROP_TOOLTIP, &tooltip,
NAOBJECT_ITEM_PROP_ICON, &icon,
NAOBJECT_ITEM_PROP_ENABLED, &enabled,
+ NAOBJECT_ITEM_PROP_TARGET_SELECTION, &target_selection,
+ NAOBJECT_ITEM_PROP_TARGET_BACKGROUND, &target_background,
+ NAOBJECT_ITEM_PROP_TARGET_TOOLBAR, &target_toolbar,
NAOBJECT_ITEM_PROP_PROVIDER, &provider,
NULL );
@@ -793,6 +982,9 @@ object_copy( NAObject *target, const NAObject *source )
NAOBJECT_ITEM_PROP_TOOLTIP, tooltip,
NAOBJECT_ITEM_PROP_ICON, icon,
NAOBJECT_ITEM_PROP_ENABLED, enabled,
+ NAOBJECT_ITEM_PROP_TARGET_SELECTION, target_selection,
+ NAOBJECT_ITEM_PROP_TARGET_BACKGROUND, target_background,
+ NAOBJECT_ITEM_PROP_TARGET_TOOLBAR, target_toolbar,
NAOBJECT_ITEM_PROP_PROVIDER, provider,
NULL );
@@ -863,6 +1055,21 @@ object_are_equal( const NAObject *a, const NAObject *b )
}
if( equal ){
+ equal = ( NA_OBJECT_ITEM( a )->private->target_selection && NA_OBJECT_ITEM( b )->private->target_selection ) ||
+ ( !NA_OBJECT_ITEM( a )->private->target_selection && !NA_OBJECT_ITEM( b )->private->target_selection );
+ }
+
+ if( equal ){
+ equal = ( NA_OBJECT_ITEM( a )->private->target_background && NA_OBJECT_ITEM( b )->private->target_background ) ||
+ ( !NA_OBJECT_ITEM( a )->private->target_background && !NA_OBJECT_ITEM( b )->private->target_background );
+ }
+
+ if( equal ){
+ equal = ( NA_OBJECT_ITEM( a )->private->target_toolbar && NA_OBJECT_ITEM( b )->private->target_toolbar ) ||
+ ( !NA_OBJECT_ITEM( a )->private->target_toolbar && !NA_OBJECT_ITEM( b )->private->target_toolbar );
+ }
+
+ if( equal ){
equal = ( g_list_length( NA_OBJECT_ITEM( a )->private->items ) == g_list_length( NA_OBJECT_ITEM( b )->private->items ));
if( !equal ){
g_debug( "length: a=%d, b=%d", g_list_length( NA_OBJECT_ITEM( a )->private->items ), g_list_length( NA_OBJECT_ITEM( b )->private->items ));
diff --git a/src/runtime/na-object-profile-fn.h b/src/runtime/na-object-profile-fn.h
index 85afcfe..b730875 100644
--- a/src/runtime/na-object-profile-fn.h
+++ b/src/runtime/na-object-profile-fn.h
@@ -44,6 +44,14 @@
G_BEGIN_DECLS
+/* targets
+ */
+enum {
+ ITEM_TARGET_SELECTION = 1,
+ ITEM_TARGET_BACKGROUND,
+ ITEM_TARGET_TOOLBAR
+};
+
/* internal identifier of profiles must begin with the following prefix
* this let us identify a profile key versus an action key
* corollarily, no action entry must begin with this same prefix
@@ -64,6 +72,7 @@ gboolean na_object_profile_get_is_file( const NAObjectProfile *profile )
gboolean na_object_profile_get_is_dir( const NAObjectProfile *profile );
gboolean na_object_profile_get_multiple( const NAObjectProfile *profile );
GSList *na_object_profile_get_schemes( const NAObjectProfile *profile );
+GSList *na_object_profile_get_folders( const NAObjectProfile *profile );
void na_object_profile_set_path( NAObjectProfile *profile, const gchar *path );
void na_object_profile_set_parameters( NAObjectProfile *profile, const gchar *parameters );
@@ -75,9 +84,10 @@ void na_object_profile_set_isdir( NAObjectProfile *profile, gboolean
void na_object_profile_set_isfiledir( NAObjectProfile *profile, gboolean isfile, gboolean isdir );
void na_object_profile_set_multiple( NAObjectProfile *profile, gboolean multiple );
void na_object_profile_set_schemes( NAObjectProfile *profile, GSList *schemes );
+void na_object_profile_set_folders( NAObjectProfile *profile, GSList *folders );
-gboolean na_object_profile_is_candidate( const NAObjectProfile *profile, GList *files );
-gchar *na_object_profile_parse_parameters( const NAObjectProfile *profile, GList *files );
+gboolean na_object_profile_is_candidate( const NAObjectProfile *profile, gint target, GList *files );
+gchar *na_object_profile_parse_parameters( const NAObjectProfile *profile, gint target, GList *files );
G_END_DECLS
diff --git a/src/runtime/na-object-profile-priv.h b/src/runtime/na-object-profile-priv.h
index 8f34971..4483067 100644
--- a/src/runtime/na-object-profile-priv.h
+++ b/src/runtime/na-object-profile-priv.h
@@ -38,19 +38,26 @@ G_BEGIN_DECLS
/* private instance data
*/
struct NAObjectProfilePrivate {
- gboolean dispose_has_run;
+ gboolean dispose_has_run;
/* profile properties
*/
- gchar *path;
- gchar *parameters;
- GSList *basenames;
- gboolean match_case;
- GSList *mimetypes;
- gboolean is_file;
- gboolean is_dir;
- gboolean accept_multiple;
- GSList *schemes;
+ gchar *path;
+ gchar *parameters;
+
+ /* ... for nature 'FileSelection'
+ */
+ GSList *basenames;
+ gboolean match_case;
+ GSList *mimetypes;
+ gboolean is_file;
+ gboolean is_dir;
+ gboolean accept_multiple;
+ GSList *schemes;
+
+ /* ... for nature 'Background'
+ */
+ GSList *folders;
};
G_END_DECLS
diff --git a/src/runtime/na-object-profile.c b/src/runtime/na-object-profile.c
index 699cc6b..5075dfd 100644
--- a/src/runtime/na-object-profile.c
+++ b/src/runtime/na-object-profile.c
@@ -59,7 +59,8 @@ enum {
NAPROFILE_PROP_ISFILE_ID,
NAPROFILE_PROP_ISDIR_ID,
NAPROFILE_PROP_ACCEPT_MULTIPLE_ID,
- NAPROFILE_PROP_SCHEMES_ID
+ NAPROFILE_PROP_SCHEMES_ID,
+ NAPROFILE_PROP_FOLDERS_ID
};
#define NAPROFILE_PROP_PATH "na-profile-path"
@@ -71,6 +72,7 @@ enum {
#define NAPROFILE_PROP_ISDIR "na-profile-isdir"
#define NAPROFILE_PROP_ACCEPT_MULTIPLE "na-profile-accept-multiple"
#define NAPROFILE_PROP_SCHEMES "na-profile-schemes"
+#define NAPROFILE_PROP_FOLDERS "na-profile-folders"
static NAObjectClass *st_parent_class = NULL;
@@ -82,7 +84,10 @@ static void instance_set_property( GObject *object, guint property_id, cons
static void instance_dispose( GObject *object );
static void instance_finalize( GObject *object );
-static int validate_schemes( GSList* schemes2test, NautilusFileInfo* file );
+static gboolean is_target_background_candidate( const NAObjectProfile *profile, NautilusFileInfo *current_folder );
+static gboolean is_target_toolbar_candidate( const NAObjectProfile *profile, NautilusFileInfo *current_folder );
+static gboolean is_target_selection_candidate( const NAObjectProfile *profile, GList *files );
+static int validate_schemes( GSList *schemes2test, NautilusFileInfo *file );
static void object_dump( const NAObject *profile );
static void object_dump_list( const gchar *thisfn, const gchar *label, GSList *list );
@@ -95,6 +100,7 @@ static gboolean is_valid_filenames( const NAObjectProfile *profile );
static gboolean is_valid_mimetypes( const NAObjectProfile *profile );
static gboolean is_valid_isfiledir( const NAObjectProfile *profile );
static gboolean is_valid_schemes( const NAObjectProfile *profile );
+static gboolean is_valid_folders( const NAObjectProfile *profile );
static gchar *object_id_new_id( const NAObjectId *object, const NAObjectId *new_parent );
@@ -208,10 +214,17 @@ class_init( NAObjectProfileClass *klass )
spec = g_param_spec_pointer(
NAPROFILE_PROP_SCHEMES,
"Schemes",
- "list of selectable schemes",
+ "List of selectable schemes",
G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE );
g_object_class_install_property( object_class, NAPROFILE_PROP_SCHEMES_ID, spec );
+ spec = g_param_spec_pointer(
+ NAPROFILE_PROP_FOLDERS,
+ "Folders",
+ "List of folders to which a Background profile applies",
+ G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE );
+ g_object_class_install_property( object_class, NAPROFILE_PROP_FOLDERS_ID, spec );
+
klass->private = g_new0( NAObjectProfileClassPrivate, 1 );
NA_OBJECT_CLASS( klass )->dump = object_dump;
@@ -242,16 +255,14 @@ instance_init( GTypeInstance *instance, gpointer klass )
*/
self->private->path = g_strdup( "" );
self->private->parameters = g_strdup( "" );
- self->private->basenames = NULL;
- self->private->basenames = g_slist_append( self->private->basenames, g_strdup( "*" ));
+ self->private->basenames = g_slist_append( NULL, g_strdup( "*" ));
self->private->match_case = TRUE;
- self->private->mimetypes = NULL;
- self->private->mimetypes = g_slist_append( self->private->mimetypes, g_strdup( "*/*" ));
+ self->private->mimetypes = g_slist_append( NULL, g_strdup( "*/*" ));
self->private->is_file = TRUE;
self->private->is_dir = FALSE;
self->private->accept_multiple = FALSE;
- self->private->schemes = NULL;
- self->private->schemes = g_slist_append( self->private->schemes, g_strdup( "file" ));
+ self->private->schemes = g_slist_append( NULL, g_strdup( "file" ));
+ self->private->folders = g_slist_append( NULL, g_strdup( "*" ));
}
static void
@@ -305,6 +316,11 @@ instance_get_property( GObject *object, guint property_id, GValue *value, GParam
g_value_set_pointer( value, list );
break;
+ case NAPROFILE_PROP_FOLDERS_ID:
+ list = na_utils_duplicate_string_list( self->private->folders );
+ g_value_set_pointer( value, list );
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID( object, property_id, spec );
break;
@@ -364,6 +380,11 @@ instance_set_property( GObject *object, guint property_id, const GValue *value,
self->private->schemes = na_utils_duplicate_string_list( g_value_get_pointer( value ));
break;
+ case NAPROFILE_PROP_FOLDERS_ID:
+ na_utils_free_string_list( self->private->folders );
+ self->private->folders = na_utils_duplicate_string_list( g_value_get_pointer( value ));
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID( object, property_id, spec );
break;
@@ -407,6 +428,7 @@ instance_finalize( GObject *object )
na_utils_free_string_list( self->private->basenames );
na_utils_free_string_list( self->private->mimetypes );
na_utils_free_string_list( self->private->schemes );
+ na_utils_free_string_list( self->private->folders );
g_free( self->private );
@@ -663,6 +685,32 @@ na_object_profile_get_schemes( const NAObjectProfile *profile )
}
/**
+ * na_object_profile_get_folders:
+ * @profile: the #NAObjectProfile to be requested.
+ *
+ * Returns the list of folders this profile applies to.
+ *
+ * Returns: a GSList of newly allocated strings. The list must be
+ * na_utils_free_string_list() by the caller.
+ *
+ * See na_object_profile_set_folders() for some rationale about
+ * folders.
+ */
+GSList *
+na_object_profile_get_folders( const NAObjectProfile *profile )
+{
+ GSList *folders = NULL;
+
+ g_return_val_if_fail( NA_IS_OBJECT_PROFILE( profile ), NULL );
+
+ if( !profile->private->dispose_has_run ){
+ g_object_get( G_OBJECT( profile ), NAPROFILE_PROP_FOLDERS, &folders, NULL );
+ }
+
+ return( folders );
+}
+
+/**
* na_object_profile_set_path:
* @profile: the #NAObjectProfile to be updated.
* @path: the command path to be set.
@@ -855,7 +903,7 @@ na_object_profile_set_multiple( NAObjectProfile *profile, gboolean multiple )
*
* Sets the schemes on which this profile applies.
*
- * #NAObjectProfile takes a copy of the provided mimetypes. This later
+ * #NAObjectProfile takes a copy of the provided schemes. This later
* may so be na_utils_free_string_list() by the caller after this
* function returns.
*
@@ -873,8 +921,30 @@ na_object_profile_set_schemes( NAObjectProfile *profile, GSList *schemes )
}
/**
+ * na_object_profile_set_folders:
+ * @profile: the #NAObjectProfile to be updated.
+ * @folders: list of folders which apply.
+ *
+ * Sets the folders on which this profile applies.
+ *
+ * #NAObjectProfile takes a copy of the provided folders. This later
+ * may so be na_utils_free_string_list() by the caller after this
+ * function returns.
+ */
+void
+na_object_profile_set_folders( NAObjectProfile *profile, GSList *folders )
+{
+ g_return_if_fail( NA_IS_OBJECT_PROFILE( profile ));
+
+ if( !profile->private->dispose_has_run ){
+ g_object_set( G_OBJECT( profile ), NAPROFILE_PROP_FOLDERS, folders, NULL );
+ }
+}
+
+/**
* na_object_profile_is_candidate:
* @profile: the #NAObjectProfile to be checked.
+ * @target: the current target.
* @files: the currently selected items, as provided by Nautilus.
*
* Determines if the given profile is candidate to be displayed in the
@@ -885,13 +955,47 @@ na_object_profile_set_schemes( NAObjectProfile *profile, GSList *schemes )
* valid candidate to be displayed in Nautilus context menu, %FALSE
* else.
*
- * This method could have been leaved outside of the #NAObjectProfile
+ * This method could have been left outside of the #NAObjectProfile
* class, as it is only called by the plugin. Nonetheless, it is much
* more easier to code here (because we don't need all get methods, nor
* free the parameters after).
*/
gboolean
-na_object_profile_is_candidate( const NAObjectProfile *profile, GList* files )
+na_object_profile_is_candidate( const NAObjectProfile *profile, gint target, GList *files )
+{
+ gboolean is_candidate;
+
+ switch( target ){
+ case ITEM_TARGET_BACKGROUND:
+ is_candidate = is_target_background_candidate( profile, ( NautilusFileInfo * ) files->data );
+ break;
+
+ case ITEM_TARGET_TOOLBAR:
+ is_candidate = is_target_toolbar_candidate( profile, ( NautilusFileInfo * ) files->data );
+ break;
+
+ case ITEM_TARGET_SELECTION:
+ default:
+ is_candidate = is_target_selection_candidate( profile, files );
+ }
+
+ return( is_candidate );
+}
+
+static gboolean
+is_target_background_candidate( const NAObjectProfile *profile, NautilusFileInfo *current_folder )
+{
+ return( TRUE );
+}
+
+static gboolean
+is_target_toolbar_candidate( const NAObjectProfile *profile, NautilusFileInfo *current_folder )
+{
+ return( TRUE );
+}
+
+static gboolean
+is_target_selection_candidate( const NAObjectProfile *profile, GList *files )
{
gboolean retv = FALSE;
gboolean test_multiple_file = FALSE;
@@ -1119,7 +1223,7 @@ na_object_profile_is_candidate( const NAObjectProfile *profile, GList* files )
* Expands the parameters path, in function of the found tokens.
*
* @profile: the selected profile.
- *
+ * @target: the current target.
* @files: the list of currently selected items, as provided by Nautilus.
*
* Valid parameters are :
@@ -1143,7 +1247,7 @@ na_object_profile_is_candidate( const NAObjectProfile *profile, GList* files )
* - src/nact/nautilus-actions-config-tool.ui:LegendDialog
*/
gchar *
-na_object_profile_parse_parameters( const NAObjectProfile *profile, GList* files )
+na_object_profile_parse_parameters( const NAObjectProfile *profile, gint target, GList* files )
{
gchar *parsed = NULL;
GString *string;
@@ -1488,17 +1592,34 @@ gboolean
object_is_valid( const NAObject *profile )
{
gboolean is_valid = FALSE;
+ NAObjectItem *parent;
g_return_val_if_fail( NA_IS_OBJECT_PROFILE( profile ), FALSE );
if( !NA_OBJECT_PROFILE( profile )->private->dispose_has_run ){
is_valid =
- is_valid_path_parameters( NA_OBJECT_PROFILE( profile )) &&
- is_valid_filenames( NA_OBJECT_PROFILE( profile )) &&
- is_valid_mimetypes( NA_OBJECT_PROFILE( profile )) &&
- is_valid_isfiledir( NA_OBJECT_PROFILE( profile )) &&
- is_valid_schemes( NA_OBJECT_PROFILE( profile ));
+ is_valid_path_parameters( NA_OBJECT_PROFILE( profile ));
+
+ if( is_valid ){
+ parent = na_object_get_parent( profile );
+
+ if( na_object_is_target_background( parent )){
+ is_valid =
+ is_valid_folders( NA_OBJECT_PROFILE( profile ));
+
+ } else if( na_object_is_target_toolbar( parent )){
+ is_valid =
+ is_valid_folders( NA_OBJECT_PROFILE( profile ));
+
+ } else {
+ is_valid =
+ is_valid_filenames( NA_OBJECT_PROFILE( profile )) &&
+ is_valid_mimetypes( NA_OBJECT_PROFILE( profile )) &&
+ is_valid_isfiledir( NA_OBJECT_PROFILE( profile )) &&
+ is_valid_schemes( NA_OBJECT_PROFILE( profile ));
+ }
+ }
}
return( is_valid );
@@ -1565,6 +1686,16 @@ is_valid_schemes( const NAObjectProfile *profile )
return( valid );
}
+static gboolean
+is_valid_folders( const NAObjectProfile *profile )
+{
+ gboolean valid;
+
+ valid = g_slist_length( profile->private->folders ) > 0;
+
+ return( valid );
+}
+
/*
* new_parent is specifically set to be able to allocate a new id for
* the current profile into the target parent
diff --git a/src/utils/nautilus-actions-new.c b/src/utils/nautilus-actions-new.c
index ad8ee92..baf9675 100644
--- a/src/utils/nautilus-actions-new.c
+++ b/src/utils/nautilus-actions-new.c
@@ -121,12 +121,12 @@ main( int argc, char** argv )
}
if( !label || !g_utf8_strlen( label, -1 )){
- g_printerr( _( "Error: an action label is mandatory." ));
+ g_printerr( _( "Error: an action label is mandatory.\n" ));
exit_with_usage();
}
if( output_gconf && output_dir ){
- g_printerr( _( "Error: only one output option may be specified." ));
+ g_printerr( _( "Error: only one output option may be specified.\n" ));
exit_with_usage();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]