Replace deprecated gdk_screen_make_display_name
[geeqie.git] / src / layout-image.cc
index 762d823..4745404 100644 (file)
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-#include "main.h"
 #include "layout-image.h"
 
+#include <cstring>
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+#include <gdk/gdk.h>
+#include <gio/gio.h>
+#include <glib-object.h>
+#include <pango/pango.h>
+
+#include <config.h>
+
+#include "archives.h"
 #include "collect.h"
+#include "debug.h"
 #include "dnd.h"
 #include "editors.h"
 #include "exif.h"
 #include "filedata.h"
 #include "fullscreen.h"
 #include "history-list.h"
-#include "image.h"
 #include "image-overlay.h"
+#include "image.h"
 #include "img-view.h"
+#include "intl.h"
 #include "layout-util.h"
+#include "layout.h"
+#include "main-defines.h"
 #include "menu.h"
 #include "metadata.h"
 #include "misc.h"
-#include "pixbuf-util.h"
+#include "options.h"
 #include "pixbuf-renderer.h"
 #include "slideshow.h"
 #include "ui-fileops.h"
 #include "ui-menu.h"
+#include "ui-utildlg.h"
 #include "uri-utils.h"
 #include "utilops.h"
 #include "view-file.h"
 
-#define FILE_COLUMN_POINTER 0
-
 static GtkWidget *layout_image_pop_menu(LayoutWindow *lw);
 static void layout_image_set_buttons(LayoutWindow *lw);
 static gboolean layout_image_animate_new_file(LayoutWindow *lw);
@@ -284,6 +297,21 @@ static gboolean layout_image_slideshow_continue_check(LayoutWindow *lw)
  *----------------------------------------------------------------------------
  */
 
+struct AnimationData
+{
+       ImageWindow *iw;
+       LayoutWindow *lw;
+       GdkPixbufAnimation *gpa;
+       GdkPixbufAnimationIter *iter;
+       GdkPixbuf *gpb;
+       FileData *data_adr;
+       gint delay;
+       gboolean valid;
+       GCancellable *cancellable;
+       GFile *in_file;
+       GFileInputStream *gfstream;
+};
+
 static void image_animation_data_free(AnimationData *fd)
 {
        if(!fd) return;
@@ -580,6 +608,12 @@ static void li_pop_menu_copy_path_unquoted_cb(GtkWidget *, gpointer data)
        file_util_copy_path_to_clipboard(layout_image_get_fd(lw), FALSE);
 }
 
+#if HAVE_GTK4
+static void li_pop_menu_copy_image_cb(GtkWidget *, gpointer data)
+{
+/* @FIXME GTK4 stub */
+}
+#else
 static void li_pop_menu_copy_image_cb(GtkWidget *, gpointer data)
 {
        auto lw = static_cast<LayoutWindow *>(data);
@@ -590,6 +624,7 @@ static void li_pop_menu_copy_image_cb(GtkWidget *, gpointer data)
        if (!pixbuf) return;
        gtk_clipboard_set_image(gtk_clipboard_get(GDK_SELECTION_CLIPBOARD), pixbuf);
 }
+#endif
 
 static void li_pop_menu_move_cb(GtkWidget *widget, gpointer data)
 {
@@ -695,7 +730,7 @@ static void li_open_archive_cb(GtkWidget *, gpointer data)
                }
        else
                {
-               warning_dialog(_("Cannot open archive file"), _("See the Log Window"), GTK_STOCK_DIALOG_WARNING, nullptr);
+               warning_dialog(_("Cannot open archive file"), _("See the Log Window"), GQ_ICON_DIALOG_WARNING, nullptr);
                }
 }
 
@@ -869,6 +904,8 @@ static GtkWidget *layout_image_pop_menu(LayoutWindow *lw)
 
        item = menu_item_add_check(menu, _("Hide file _list"), lw->options.tools_hidden,
                                   G_CALLBACK(li_pop_menu_hide_cb), lw);
+
+       item = menu_item_add_check(menu, _("Hide Selectable Bars"), lw->options.selectable_toolbars_hidden, G_CALLBACK(layout_selectable_toolbars_toggle), lw);
        if (fullscreen) gtk_widget_set_sensitive(item, FALSE);
 
        return menu;
@@ -1222,7 +1259,7 @@ void layout_image_alter_orientation(LayoutWindow *lw, AlterType type)
                        {
                        tpath = static_cast<GtkTreePath *>(work->data);
                        gtk_tree_model_get_iter(store, &iter, tpath);
-                       gtk_tree_model_get(store, &iter, FILE_COLUMN_POINTER, &fd_n, -1);
+                       gtk_tree_model_get(store, &iter, VIEW_FILE_COLUMN_POINTER, &fd_n, -1);
                        work = work->next;
                        }
 
@@ -1271,7 +1308,7 @@ void layout_image_rating(LayoutWindow *lw, const gchar *rating)
                        {
                        tpath = static_cast<GtkTreePath *>(work->data);
                        gtk_tree_model_get_iter(store, &iter, tpath);
-                       gtk_tree_model_get(store, &iter, FILE_COLUMN_POINTER, &fd_n, -1);
+                       gtk_tree_model_get(store, &iter, VIEW_FILE_COLUMN_POINTER, &fd_n, -1);
                        work = work->next;
                        }
 
@@ -1402,7 +1439,7 @@ const gchar *layout_image_get_path(LayoutWindow *lw)
 #pragma GCC diagnostic ignored "-Wunused-function"
 const gchar *layout_image_get_name_unused(LayoutWindow *lw)
 {
-       if (!layout_valid(&lw)) return NULL;
+       if (!layout_valid(&lw)) return nullptr;
 
        return image_get_name(lw->image);
 }
@@ -1890,7 +1927,7 @@ static void layout_image_button_cb(ImageWindow *imd, GdkEventButton *event, gpoi
                                        }
                                else
                                        {
-                                       warning_dialog(_("Cannot open archive file"), _("See the Log Window"), GTK_STOCK_DIALOG_WARNING, nullptr);
+                                       warning_dialog(_("Cannot open archive file"), _("See the Log Window"), GQ_ICON_DIALOG_WARNING, nullptr);
                                        }
                                }
                        else if (options->image_l_click_video && options->image_l_click_video_editor && imd-> image_fd && imd->image_fd->format_class == FORMAT_CLASS_VIDEO)
@@ -1985,7 +2022,8 @@ static void layout_image_drag_cb(ImageWindow *imd, GdkEventMotion *event, gdoubl
 {
        gint i;
        auto lw = static_cast<LayoutWindow *>(data);
-       gdouble sx, sy;
+       gdouble sx;
+       gdouble sy;
 
        if (lw->full_screen && lw->image != lw->full_screen->imd &&
            imd != lw->full_screen->imd)
@@ -2095,8 +2133,10 @@ static gint num_length(gint num)
 void layout_status_update_pixel_cb(PixbufRenderer *pr, gpointer data)
 {
        auto lw = static_cast<LayoutWindow *>(data);
-       gint x_pixel, y_pixel;
-       gint width, height;
+       gint x_pixel;
+       gint y_pixel;
+       gint width;
+       gint height;
        gchar *text;
        PangoAttrList *attrs;
 
@@ -2110,7 +2150,9 @@ void layout_status_update_pixel_cb(PixbufRenderer *pr, gpointer data)
 
        if(x_pixel >= 0 && y_pixel >= 0)
                {
-               gint r_mouse, g_mouse, b_mouse;
+               gint r_mouse;
+               gint g_mouse;
+               gint b_mouse;
 
                pixbuf_renderer_get_pixel_colors(pr, x_pixel, y_pixel,
                                                 &r_mouse, &g_mouse, &b_mouse);
@@ -2281,7 +2323,8 @@ static void layout_image_setup_split_common(LayoutWindow *lw, gint n)
 
                        if (img_fd)
                                {
-                               gdouble sx, sy;
+                               gdouble sx;
+                               gdouble sy;
                                image_change_fd(lw->split_images[i], img_fd, zoom);
                                image_get_scroll_center(lw->image, &sx, &sy);
                                image_set_scroll_center(lw->split_images[i], sx, sy);