Drop unused layout_new()
authorArkadiy Illarionov <[email protected]>
Tue, 4 Feb 2025 19:17:58 +0000 (22:17 +0300)
committerColin Clark <[email protected]>
Wed, 5 Feb 2025 10:05:05 +0000 (10:05 +0000)
Rename layout_new_with_geometry() to layout_new() and make static.
Simplify new layout_new() parameters.

src/layout.cc
src/layout.h
src/main.cc

index 8afc23fad486a40bf8d6036bd9a2a9b0056093c5..58f0225d4fe2ddb83610dc600fa31f37baab8bb1 100644 (file)
@@ -2521,11 +2521,6 @@ static gboolean layout_delete_cb(GtkWidget *, GdkEventAny *, gpointer data)
        return TRUE;
 }
 
-LayoutWindow *layout_new(FileData *dir_fd, LayoutOptions *lop)
-{
-       return layout_new_with_geometry(dir_fd, lop, nullptr);
-}
-
 static gboolean move_window_to_workspace_cb(gpointer data)
 {
 #ifdef GDK_WINDOWING_X11
@@ -2550,8 +2545,7 @@ static gboolean move_window_to_workspace_cb(gpointer data)
        return G_SOURCE_REMOVE;
 }
 
-LayoutWindow *layout_new_with_geometry(FileData *dir_fd, LayoutOptions *lop,
-                                      const gchar *geometry)
+static LayoutWindow *layout_new(const LayoutOptions &lop, const gchar *geometry)
 {
        LayoutWindow *lw;
        GdkGeometry hint;
@@ -2561,10 +2555,7 @@ LayoutWindow *layout_new_with_geometry(FileData *dir_fd, LayoutOptions *lop,
        DEBUG_1("%s layout_new: start", get_exec_time());
        lw = g_new0(LayoutWindow, 1);
 
-       if (lop)
-               copy_layout_options(&lw->options, lop);
-       else
-               init_layout_options(&lw->options);
+       copy_layout_options(&lw->options, &lop);
 
        layout_set_unique_id(lw);
 
@@ -2643,21 +2634,11 @@ LayoutWindow *layout_new_with_geometry(FileData *dir_fd, LayoutOptions *lop,
        layout_util_sync(lw);
        layout_status_update_all(lw);
 
-       if (dir_fd)
-               {
-               layout_set_fd(lw, dir_fd);
-               }
-       else
-               {
-               GdkPixbuf *pixbuf;
-
-               pixbuf = pixbuf_inline(PIXBUF_INLINE_LOGO);
+       g_autoptr(GdkPixbuf) pixbuf = pixbuf_inline(PIXBUF_INLINE_LOGO);
 
-               /** @FIXME the zoom value set here is the value, which is then copied again and again
-                  in 'Leave Zoom at previous setting' mode. This is not ideal.  */
-               image_change_pixbuf(lw->image, pixbuf, 0.0, FALSE);
-               g_object_unref(pixbuf);
-               }
+       /** @FIXME the zoom value set here is the value, which is then copied again and again
+          in 'Leave Zoom at previous setting' mode. This is not ideal.  */
+       image_change_pixbuf(lw->image, pixbuf, 0.0, FALSE);
 
        if (geometry)
                {
@@ -2971,7 +2952,6 @@ static gboolean first_found = FALSE;
 LayoutWindow *layout_new_from_config(const gchar **attribute_names, const gchar **attribute_values, gboolean use_commandline)
 {
        LayoutOptions lop;
-       LayoutWindow *lw;
        g_autofree gchar *path = nullptr;
 
        init_layout_options(&lop);
@@ -2991,7 +2971,7 @@ LayoutWindow *layout_new_from_config(const gchar **attribute_names, const gchar
                layout_config_startup_path(&lop, &path);
                }
 
-       lw = layout_new_with_geometry(nullptr, &lop, use_commandline ? command_line->geometry : nullptr);
+       LayoutWindow *lw = layout_new(lop, use_commandline ? command_line->geometry : nullptr);
        layout_sort_set_files(lw, lw->options.file_view_list_sort.method, lw->options.file_view_list_sort.ascend, lw->options.file_view_list_sort.case_sensitive);
 
 
index 44a4423ed82b2b941e39833aabd39dddb203cd5c..778f10591b3123f9b5efa5370a8a8592255d6a3c 100644 (file)
@@ -151,9 +151,6 @@ struct LayoutWindow
        GtkWidget *log_window;
 };
 
-LayoutWindow *layout_new(FileData *dir_fd, LayoutOptions *lop);
-LayoutWindow *layout_new_with_geometry(FileData *dir_fd, LayoutOptions *lop,
-                                      const gchar *geometry);
 LayoutWindow *layout_new_from_config(const gchar **attribute_names, const gchar **attribute_values, gboolean use_commandline);
 void layout_update_from_config(LayoutWindow *lw, const gchar **attribute_names, const gchar **attribute_values);
 LayoutWindow *layout_new_from_default();
index 0b8579b8fde780d6063ff0b86a9c46100e5bb5d7..90e4f898a6d946357136544aa73d9e9f6de4fa34 100644 (file)
@@ -910,7 +910,7 @@ void activate_cb(GtkApplication *, gpointer)
         * The startup signal is issued before the command_line signal, therefore
         * the window layout processing is done before the command line processing.
         *
-        * Function layout_new_with_geometry() does not execute a gtk_window_show()
+        * Function layout_new() does not execute a gtk_window_show()
         * if this is the first window - i.e. Geeqie is not yet fully running.
         *
         * The activate signal is issued in command_line_cb() after the