Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions libnemo-private/nemo-global-preferences.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,23 @@ nemo_global_preferences_get_tooltip_flags (void)
return flags;
}

gboolean
nemo_global_preferences_should_load_plugin (const gchar *name, const gchar *key)
{
gchar **disabled_list = g_settings_get_strv (nemo_plugin_preferences, key);

gboolean ret = TRUE;
gint i = 0;

for (i = 0; i < g_strv_length (disabled_list); i++) {
if (g_strcmp0 (disabled_list[i], name) == 0)
ret = FALSE;
}

g_strfreev (disabled_list);
return ret;
}

static void
ignore_view_metadata_cb (GSettings *settings,
gchar *key,
Expand All @@ -108,10 +125,12 @@ nemo_global_preferences_init (void)
nemo_compact_view_preferences = g_settings_new("org.nemo.compact-view");
nemo_desktop_preferences = g_settings_new("org.nemo.desktop");
nemo_tree_sidebar_preferences = g_settings_new("org.nemo.sidebar-panels.tree");
nemo_plugin_preferences = g_settings_new("org.nemo.plugins");
gnome_lockdown_preferences = g_settings_new("org.cinnamon.desktop.lockdown");
gnome_background_preferences = g_settings_new("org.cinnamon.desktop.background");
gnome_media_handling_preferences = g_settings_new("org.cinnamon.desktop.media-handling");
gnome_terminal_preferences = g_settings_new("org.cinnamon.desktop.default-applications.terminal");
cinnamon_privacy_preferences = g_settings_new("org.cinnamon.desktop.privacy");

ignore_view_metadata = g_settings_get_boolean (nemo_preferences, NEMO_PREFERENCES_IGNORE_VIEW_METADATA);

Expand Down
25 changes: 24 additions & 1 deletion libnemo-private/nemo-global-preferences.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ typedef enum
/* Single/Double click preference */
#define NEMO_PREFERENCES_CLICK_POLICY "click-policy"

/* Quick renames with two single clicks and pause in-between*/
#define NEMO_PREFERENCES_QUICK_RENAMES_WITH_PAUSE_IN_BETWEEN "quick-renames-with-pause-in-between"

/* Activating executable text files */
#define NEMO_PREFERENCES_EXECUTABLE_TEXT_ACTIVATION "executable-text-activation"

Expand All @@ -76,14 +79,19 @@ typedef enum
#define NEMO_PREFERENCES_NEW_TAB_POSITION "tabs-open-position"

#define NEMO_PREFERENCES_SHOW_LOCATION_ENTRY "show-location-entry"
#define NEMO_PREFERENCES_SHOW_PREVIOUS_ICON_TOOLBAR "show-previous-icon-toolbar"
#define NEMO_PREFERENCES_SHOW_NEXT_ICON_TOOLBAR "show-next-icon-toolbar"
#define NEMO_PREFERENCES_SHOW_UP_ICON_TOOLBAR "show-up-icon-toolbar"
#define NEMO_PREFERENCES_SHOW_EDIT_ICON_TOOLBAR "show-edit-icon-toolbar"
#define NEMO_PREFERENCES_SHOW_RELOAD_ICON_TOOLBAR "show-reload-icon-toolbar"
#define NEMO_PREFERENCES_SHOW_HOME_ICON_TOOLBAR "show-home-icon-toolbar"
#define NEMO_PREFERENCES_SHOW_COMPUTER_ICON_TOOLBAR "show-computer-icon-toolbar"
#define NEMO_PREFERENCES_SHOW_SEARCH_ICON_TOOLBAR "show-search-icon-toolbar"
#define NEMO_PREFERENCES_SHOW_NEW_FOLDER_ICON_TOOLBAR "show-new-folder-icon-toolbar"
#define NEMO_PREFERENCES_SHOW_LABEL_SEARCH_ICON_TOOLBAR "show-label-search-icon-toolbar"
#define NEMO_PREFERENCES_SHOW_OPEN_IN_TERMINAL_TOOLBAR "show-open-in-terminal-toolbar"
#define NEMO_PREFERENCES_SHOW_ICON_VIEW_ICON_TOOLBAR "show-icon-view-icon-toolbar"
#define NEMO_PREFERENCES_SHOW_LIST_VIEW_ICON_TOOLBAR "show-list-view-icon-toolbar"
#define NEMO_PREFERENCES_SHOW_COMPACT_VIEW_ICON_TOOLBAR "show-compact-view-icon-toolbar"

/* Which views should be displayed for new windows */
#define NEMO_WINDOW_STATE_START_WITH_STATUS_BAR "start-with-status-bar"
Expand All @@ -95,6 +103,7 @@ typedef enum
#define NEMO_WINDOW_STATE_MAXIMIZED "maximized"
#define NEMO_WINDOW_STATE_SIDEBAR_WIDTH "sidebar-width"
#define NEMO_WINDOW_STATE_MY_COMPUTER_EXPANDED "my-computer-expanded"
#define NEMO_WINDOW_STATE_BOOKMARKS_EXPANDED "bookmarks-expanded"
#define NEMO_WINDOW_STATE_DEVICES_EXPANDED "devices-expanded"
#define NEMO_WINDOW_STATE_NETWORK_EXPANDED "network-expanded"

Expand All @@ -115,6 +124,12 @@ typedef enum
#define NEMO_PREFERENCES_SHOW_BOOKMARKS_IN_TO_MENUS "show-bookmarks-in-to-menus"
#define NEMO_PREFERENCES_SHOW_PLACES_IN_TO_MENUS "show-places-in-to-menus"

#define NEMO_PREFERENCES_RECENT_ENABLED "remember-recent-files"

#define NEMO_PREFERENCES_SIDEBAR_BOOKMARK_BREAKPOINT "sidebar-bookmark-breakpoint"

#define NEMO_PREFERENCES_CONTEXT_MENUS_SHOW_ALL_ACTIONS "context-menus-show-all-actions"

enum
{
NEMO_DEFAULT_FOLDER_VIEWER_ICON_VIEW,
Expand Down Expand Up @@ -224,10 +239,16 @@ typedef enum

#define NEMO_PREFERENCES_DISABLE_MENU_WARNING "disable-menu-warning"

/* Plugins */
#define NEMO_PLUGIN_PREFERENCES_DISABLED_EXTENSIONS "disabled-extensions"
#define NEMO_PLUGIN_PREFERENCES_DISABLED_ACTIONS "disabled-actions"
#define NEMO_PLUGIN_PREFERENCES_DISABLED_SCRIPTS "disabled-scripts"

void nemo_global_preferences_init (void);
char *nemo_global_preferences_get_default_folder_viewer_preference_as_iid (void);
gboolean nemo_global_preferences_get_ignore_view_metadata (void);
gint nemo_global_preferences_get_tooltip_flags (void);
gboolean nemo_global_preferences_should_load_plugin (const gchar *name, const gchar *key);

GSettings *nemo_preferences;
GSettings *nemo_icon_view_preferences;
Expand All @@ -236,10 +257,12 @@ GSettings *nemo_compact_view_preferences;
GSettings *nemo_desktop_preferences;
GSettings *nemo_tree_sidebar_preferences;
GSettings *nemo_window_state;
GSettings *nemo_plugin_preferences;
GSettings *gnome_lockdown_preferences;
GSettings *gnome_background_preferences;
GSettings *gnome_media_handling_preferences;
GSettings *gnome_terminal_preferences;
GSettings *cinnamon_privacy_preferences;

G_END_DECLS

Expand Down
116 changes: 74 additions & 42 deletions libnemo-private/nemo-icon-container.c
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ typedef struct {
gboolean tight;
} PlacementGrid;

static guint signals[LAST_SIGNAL];
static guint signals[LAST_SIGNAL] = { 0 };

static void
tooltip_prefs_changed_callback (NemoIconContainer *container)
Expand Down Expand Up @@ -1416,9 +1416,6 @@ lay_down_icons_horizontal (NemoIconContainer *container,
}

lay_down_one_line (container, line_start, NULL, y, max_height_above, positions, TRUE);

/* Advance to next line. */
y += max_height_below + ICON_PAD_BOTTOM;
}

g_array_free (positions, TRUE);
Expand Down Expand Up @@ -1903,6 +1900,7 @@ align_icons (NemoIconContainer *container)
grid = placement_grid_new (container, TRUE);

if (!grid) {
g_list_free (unplaced_icons);
return;
}

Expand Down Expand Up @@ -4287,6 +4285,55 @@ button_press_event (GtkWidget *widget,
}

if (clicked_on_icon) {
NemoIcon *icon;//current icon which was clicked on
EelDRect icon_rect;//stores dimensions of the icon part
double eventX;//where did click event happened for x
double eventY;//where did click event happened for y
/* when icon is in renaming mode and user clicks on the image part of icon renaming should get closed */
icon = get_first_selected_icon (container);//this function gets the clicked icon
icon_rect = nemo_icon_canvas_item_get_icon_rectangle (icon->item);
eel_canvas_window_to_world (EEL_CANVAS (container), event->x, event->y, &eventX, &eventY);
if (eventX > icon_rect.x0 && eventX < icon_rect.x1 && eventY > icon_rect.y0 && eventY < icon_rect.y1 && icon == get_icon_being_renamed (container)){
end_renaming_mode (container,TRUE);
}

/* Olny if the preferences is selected and clicks are for left button do a quick renames with pause in-between */
if(event -> button == 1 && g_settings_get_boolean (nemo_preferences, NEMO_PREFERENCES_QUICK_RENAMES_WITH_PAUSE_IN_BETWEEN)){
static NemoIcon *last_icon_clicked = NULL;//this will show if icon was selected before
EelDRect text_rect;//stores dimentions of the text part
static int clicked_on_icon_text_before=0;//this is different from last_icon_clicked, here we have to make sure if it was clicked on text part
static gint64 last_time_clicked_on_icon_text_before=0;//it should be static to keep the last time it was clicked on icon
int double_click_time;//default double click time on the system


g_object_get (G_OBJECT (gtk_widget_get_settings (widget)),
"gtk-double-click-time", &double_click_time,
NULL);//this will get the default double click time for user's system

icon = get_first_selected_icon (container);//this function gets the clicked icon

/*This gets the dimentions of the text part*/
text_rect = nemo_icon_canvas_item_get_text_rectangle (icon -> item, FALSE);

/* the events get trapded into another coordinate system, this will fix it */
eel_canvas_window_to_world(EEL_CANVAS (container), event -> x, event -> y, &eventX, &eventY);

//users should click only into the text area
if((eventX > text_rect.x0 && eventX < text_rect.x1 && eventY > text_rect.y0 && eventY < text_rect.y1) ||
(eventX > icon_rect.x0 && eventX < icon_rect.x1 && eventY > icon_rect.y0 && eventY < icon_rect.y1)){
if(clicked_on_icon_text_before == 0 || last_icon_clicked != icon){//if it was not clicked before then do not rename, just mark it as being clicked
last_time_clicked_on_icon_text_before = eel_get_system_time ();
clicked_on_icon_text_before = 1;
last_icon_clicked = icon;//we need to be sure that the last icon which was clicked is the current we are clicking
}
else{//if it was clicked before then change the name, but not bafore double click time, this prevents annoying effects
if(eel_get_system_time() > last_time_clicked_on_icon_text_before+(double_click_time * 1250))
nemo_icon_container_start_renaming_selected_item(container,FALSE);//we send a FALSE so it will be smart enough to not take extentions
last_time_clicked_on_icon_text_before = 0;
clicked_on_icon_text_before = 0;
}
}
}
return TRUE;
}

Expand Down Expand Up @@ -5487,7 +5534,9 @@ key_press_event (GtkWidget *widget,
* start the typeahead find capabilities.
* Copied from NemoIconContainer */
if (!handled &&
event->keyval != GDK_KEY_slash /* don't steal slash key event, used for "go to" */ &&
event->keyval != GDK_KEY_asciitilde &&
event->keyval != GDK_KEY_KP_Divide &&
event->keyval != GDK_KEY_slash /* don't steal slash key events, used for "go to" */ &&
event->keyval != GDK_KEY_BackSpace &&
event->keyval != GDK_KEY_Delete) {
GdkEvent *new_event;
Expand Down Expand Up @@ -8332,7 +8381,7 @@ nemo_icon_container_start_renaming_selected_item (NemoIconContainer *container,
pango_font_description_free (desc);

icon_rect = nemo_icon_canvas_item_get_icon_rectangle (icon->item);
text_rect = nemo_icon_canvas_item_get_text_rectangle (icon->item, TRUE);
text_rect = nemo_icon_canvas_item_get_text_rectangle (icon->item, TRUE);

if (nemo_icon_container_is_layout_vertical (container) &&
container->details->label_position == NEMO_ICON_LABEL_POSITION_BESIDE) {
Expand Down Expand Up @@ -8367,7 +8416,13 @@ nemo_icon_container_start_renaming_selected_item (NemoIconContainer *container,
start_offset = 0;
end_offset = -1;
} else {
eel_filename_get_rename_region (editable_text, &start_offset, &end_offset);
/* if it is a directory it should select all of the text regardless of select_all option */
if (nemo_file_is_directory (icon->data)){
start_offset = 0;
end_offset = -1;
}else{
eel_filename_get_rename_region (editable_text, &start_offset, &end_offset);
}
}

gtk_widget_show (details->rename_widget);
Expand Down Expand Up @@ -8501,13 +8556,8 @@ nemo_icon_container_set_is_desktop (NemoIconContainer *container,
if (is_desktop) {
GtkStyleContext *context;

context = gtk_widget_get_style_context (GTK_WIDGET (container));
if (gtk_style_context_has_class (context, "nemo-desktop")) {
gtk_style_context_add_class (context, "nemo-desktop");
}
else {
gtk_style_context_add_class (context, "nautilus-desktop");
}
context = gtk_widget_get_style_context (GTK_WIDGET (container));
gtk_style_context_add_class (context, "nemo-desktop");
}
}

Expand Down Expand Up @@ -8894,7 +8944,6 @@ nemo_icon_container_accessible_add_selection (AtkSelection *accessible,
{
GtkWidget *widget;
NemoIconContainer *container;
GList *l;
GList *selection;
NemoIcon *icon;

Expand All @@ -8905,10 +8954,8 @@ nemo_icon_container_accessible_add_selection (AtkSelection *accessible,

container = NEMO_ICON_CONTAINER (widget);

l = g_list_nth (container->details->icons, i);
if (l) {
icon = l->data;

icon = g_list_nth_data (container->details->icons, i);
if (icon) {
selection = nemo_icon_container_get_selection (container);
selection = g_list_prepend (selection,
icon->data);
Expand Down Expand Up @@ -8945,16 +8992,13 @@ nemo_icon_container_accessible_ref_selection (AtkSelection *accessible,
{
AtkObject *atk_object;
NemoIconContainerAccessiblePrivate *priv;
GList *item;
NemoIcon *icon;

nemo_icon_container_accessible_update_selection (ATK_OBJECT (accessible));
priv = accessible_get_priv (ATK_OBJECT (accessible));

item = (g_list_nth (priv->selection, i));

if (item) {
icon = item->data;
icon = g_list_nth_data (priv->selection, i);
if (icon) {
atk_object = atk_gobject_accessible_for_object (G_OBJECT (icon->item));
if (atk_object) {
g_object_ref (atk_object);
Expand Down Expand Up @@ -8985,7 +9029,6 @@ nemo_icon_container_accessible_is_child_selected (AtkSelection *accessible,
int i)
{
NemoIconContainer *container;
GList *l;
NemoIcon *icon;
GtkWidget *widget;

Expand All @@ -8996,12 +9039,8 @@ nemo_icon_container_accessible_is_child_selected (AtkSelection *accessible,

container = NEMO_ICON_CONTAINER (widget);

l = g_list_nth (container->details->icons, i);
if (l) {
icon = l->data;
return icon->is_selected;
}
return FALSE;
icon = g_list_nth_data (container->details->icons, i);
return icon ? icon->is_selected : FALSE;
}

static gboolean
Expand All @@ -9010,7 +9049,6 @@ nemo_icon_container_accessible_remove_selection (AtkSelection *accessible,
{
NemoIconContainer *container;
NemoIconContainerAccessiblePrivate *priv;
GList *l;
GList *selection;
NemoIcon *icon;
GtkWidget *widget;
Expand All @@ -9025,10 +9063,8 @@ nemo_icon_container_accessible_remove_selection (AtkSelection *accessible,

container = NEMO_ICON_CONTAINER (widget);

l = g_list_nth (priv->selection, i);
if (l) {
icon = l->data;

icon = g_list_nth_data (priv->selection, i);
if (icon) {
selection = nemo_icon_container_get_selection (container);
selection = g_list_remove (selection, icon->data);
nemo_icon_container_set_selection (container, selection);
Expand Down Expand Up @@ -9118,7 +9154,6 @@ nemo_icon_container_accessible_ref_child (AtkObject *accessible, int i)
{
AtkObject *atk_object;
NemoIconContainer *container;
GList *item;
NemoIcon *icon;
GtkWidget *widget;

Expand All @@ -9129,11 +9164,8 @@ nemo_icon_container_accessible_ref_child (AtkObject *accessible, int i)

container = NEMO_ICON_CONTAINER (widget);

item = (g_list_nth (container->details->icons, i));

if (item) {
icon = item->data;

icon = g_list_nth_data (container->details->icons, i);
if (icon) {
atk_object = atk_gobject_accessible_for_object (G_OBJECT (icon->item));
g_object_ref (atk_object);

Expand Down
Empty file.
Loading