Fix #262: double click and fullscreen
[geeqie.git] / src / layout_image.c
index 63da73b..0872612 100644 (file)
@@ -668,8 +668,9 @@ static GtkWidget *layout_image_pop_menu(LayoutWindow *lw)
        submenu = submenu_add_edit(menu, &item, G_CALLBACK(li_pop_menu_edit_cb), lw, editmenu_fd_list);
        if (!path) gtk_widget_set_sensitive(item, FALSE);
        menu_item_add_divider(submenu);
+#if !GTK_CHECK_VERSION(3,0,0)
        menu_item_add(submenu, _("Set as _wallpaper"), G_CALLBACK(li_pop_menu_wallpaper_cb), lw);
-
+#endif
        item = submenu_add_alter(menu, G_CALLBACK(li_pop_menu_alter_cb), lw);
 
        item = menu_item_add_stock(menu, _("View in _new window"), GTK_STOCK_NEW, G_CALLBACK(li_pop_menu_new_cb), lw);
@@ -1007,12 +1008,12 @@ void layout_image_zoom_adjust_at_point(LayoutWindow *lw, gdouble increment, gint
                {
                image_zoom_adjust_at_point(lw->full_screen->imd, increment, x, y);
                }
-
-       if (!connect_zoom) return;
+       if (!connect_zoom && !lw->split_mode) return;
 
        for (i = 0; i < MAX_SPLIT_IMAGES; i++)
                {
-               if (lw->split_images[i] && lw->split_images[i] != lw->image)
+               if (lw->split_images[i] && lw->split_images[i] != lw->image &&
+                                               lw->split_images[i]->mouse_wheel_mode)
                        image_zoom_adjust_at_point(lw->split_images[i], increment, x, y);
                }
 }
@@ -1104,6 +1105,56 @@ void layout_image_alter_orientation(LayoutWindow *lw, AlterType type)
                }
 }
 
+static void image_alter_rating(FileData *fd_n, const gchar *rating)
+{
+       metadata_write_string(fd_n, RATING_KEY, rating);
+}
+
+void layout_image_rating(LayoutWindow *lw, const gchar *rating)
+{
+       if (!layout_valid(&lw)) return;
+
+       GtkTreeModel *store;
+       GList *work;
+       GtkTreeSelection *selection;
+       GtkTreePath *tpath;
+       FileData *fd_n;
+       GtkTreeIter iter;
+       IconData *id;
+
+       if (!lw || !lw->vf) return;
+
+       if (lw->vf->type == FILEVIEW_ICON)
+               {
+               if (!VFICON(lw->vf)->selection) return;
+               work = VFICON(lw->vf)->selection;
+               }
+       else
+               {
+               selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(lw->vf->listview));
+               work = gtk_tree_selection_get_selected_rows(selection, &store);
+               }
+
+       while (work)
+               {
+               if (lw->vf->type == FILEVIEW_ICON)
+                       {
+                       id = work->data;
+                       fd_n = id->fd;
+                       work = work->next;
+                       }
+               else
+                       {
+                       tpath = work->data;
+                       gtk_tree_model_get_iter(store, &iter, tpath);
+                       gtk_tree_model_get(store, &iter, FILE_COLUMN_POINTER, &fd_n, -1);
+                       work = work->next;
+                       }
+
+               image_alter_rating(fd_n, rating);
+               }
+}
+
 void layout_image_reset_orientation(LayoutWindow *lw)
 {
        ImageWindow *imd= lw->image;
@@ -1639,6 +1690,11 @@ static void layout_image_button_cb(ImageWindow *imd, GdkEventButton *event, gpoi
        switch (event->button)
                {
                case MOUSE_BUTTON_LEFT:
+                       if (event->type == GDK_2BUTTON_PRESS)
+                               {
+                               if (lw->full_screen)
+                                       layout_image_full_screen_stop(lw);
+                               }
                        if (options->image_lm_click_nav && lw->split_mode == SPLIT_NONE)
                                layout_image_next(lw);
                        break;
@@ -1672,7 +1728,8 @@ static void layout_image_scroll_cb(ImageWindow *imd, GdkEventScroll *event, gpoi
                }
 
 
-       if (event->state & GDK_CONTROL_MASK)
+       if ((event->state & GDK_CONTROL_MASK) ||
+                               (imd->mouse_wheel_mode && !options->image_lm_click_nav))
                {
                switch (event->direction)
                        {
@@ -1999,16 +2056,19 @@ static void layout_image_setup_split_common(LayoutWindow *lw, gint n)
                                GList *work = g_list_last(layout_selection_list(lw));
                                gint j = 0;
 
-                               if (work) work = work->prev;
-
                                while (work && j < i)
                                        {
                                        FileData *fd = work->data;
                                        work = work->prev;
 
-                                       j++;
-                                       if (!fd || !*fd->path) continue;
+                                       if (!fd || !*fd->path || fd->parent ||
+                                                                               fd == lw->split_images[0]->image_fd)
+                                               {
+                                               continue;
+                                               }
                                        img_fd = fd;
+
+                                       j++;
                                        }
                                }