6767 PROP_QUOTE_TYPE ,
6868 PROP_ESCAPE_SPACE ,
6969 PROP_RUN_IN_TERMINAL ,
70- PROP_CONDITIONS
70+ PROP_CONDITIONS ,
71+ PROP_URI_SCHEME ,
72+ PROP_LAST
7173};
7274
7375enum {
@@ -141,6 +143,7 @@ nemo_action_init (NemoAction *action)
141143 action -> escape_space = FALSE;
142144 action -> show_in_blank_desktop = FALSE;
143145 action -> run_in_terminal = FALSE;
146+ action -> uri_scheme = NULL ;
144147
145148 action -> constructing = TRUE;
146149}
@@ -277,6 +280,15 @@ nemo_action_class_init (NemoActionClass *klass)
277280 G_PARAM_READWRITE )
278281 );
279282
283+ g_object_class_install_property (object_class ,
284+ PROP_URI_SCHEME ,
285+ g_param_spec_string ("uri-scheme" ,
286+ "Limit selection by uri scheme (like file, sftp, etc...)" ,
287+ "Limit selection by uri scheme (like file, sftp, etc...)" ,
288+ NULL ,
289+ G_PARAM_READWRITE )
290+ );
291+
280292 signals [CONDITION_CHANGED ] = g_signal_new ("condition-changed" ,
281293 G_TYPE_FROM_CLASS (object_class ),
282294 G_SIGNAL_RUN_LAST ,
@@ -685,6 +697,11 @@ nemo_action_constructed (GObject *object)
685697 KEY_SEPARATOR ,
686698 NULL );
687699
700+ gchar * uri_scheme = g_key_file_get_string (key_file ,
701+ ACTION_FILE_GROUP ,
702+ KEY_URI_SCHEME ,
703+ NULL );
704+
688705 gchar * quote_type_string = g_key_file_get_string (key_file ,
689706 ACTION_FILE_GROUP ,
690707 KEY_QUOTE_TYPE ,
@@ -829,6 +846,7 @@ nemo_action_constructed (GObject *object)
829846 "conditions" , conditions ,
830847 "escape-space" , escape_space ,
831848 "run-in-terminal" , run_in_terminal ,
849+ "uri-scheme" , uri_scheme ,
832850 NULL );
833851
834852 action -> constructing = FALSE;
@@ -846,6 +864,7 @@ nemo_action_constructed (GObject *object)
846864 g_free (parent_dir );
847865 g_free (quote_type_string );
848866 g_free (separator );
867+ g_free (uri_scheme );
849868 g_strfreev (ext );
850869 g_strfreev (mimes );
851870 g_strfreev (conditions );
@@ -981,6 +1000,7 @@ nemo_action_finalize (GObject *object)
9811000 g_free (action -> orig_label );
9821001 g_free (action -> orig_tt );
9831002 g_free (action -> separator );
1003+ g_free (action -> uri_scheme );
9841004
9851005 if (action -> dbus ) {
9861006 g_list_free_full (action -> dbus , (GDestroyNotify ) dbus_condition_free );
@@ -1060,6 +1080,9 @@ nemo_action_set_property (GObject *object,
10601080 case PROP_RUN_IN_TERMINAL :
10611081 action -> run_in_terminal = g_value_get_boolean (value );
10621082 break ;
1083+ case PROP_URI_SCHEME :
1084+ action -> uri_scheme = g_strdup (g_value_get_string (value ));
1085+ break ;
10631086 default :
10641087 G_OBJECT_WARN_INVALID_PROPERTY_ID (object , prop_id , pspec );
10651088 break ;
@@ -1120,6 +1143,9 @@ nemo_action_get_property (GObject *object,
11201143 case PROP_RUN_IN_TERMINAL :
11211144 g_value_set_boolean (value , action -> run_in_terminal );
11221145 break ;
1146+ case PROP_URI_SCHEME :
1147+ g_value_set_string (value , action -> uri_scheme );
1148+ break ;
11231149 default :
11241150 G_OBJECT_WARN_INVALID_PROPERTY_ID (object , prop_id , pspec );
11251151 break ;
@@ -1681,6 +1707,10 @@ nemo_action_get_visibility (NemoAction *action,
16811707 if (!action -> gsettings_satisfied )
16821708 return FALSE;
16831709
1710+ if ((action -> uri_scheme != NULL ) && !nemo_file_has_uri_scheme (parent , action -> uri_scheme )) {
1711+ return FALSE;
1712+ }
1713+
16841714 // Check selection
16851715 gboolean selection_type_show = FALSE;
16861716 guint selected_count = g_list_length (selection );
0 commit comments