Commit e83482cb authored by Paolo Bacchilega's avatar Paolo Bacchilega Committed by Paolo Bacchilega
Browse files

Code reorganization. Removed gthumb-window.[ch]; created a base window

2005-05-25  Paolo Bacchilega  <paobac@cvs.gnome.org>

        * many_files: Code reorganization.  Removed gthumb-window.[ch]; created
        a base window class in gth-window.c;  moved the browser window in
        gth-browser.c; Added a viewer window in gth-viewer.c
parent 542cacf8
......@@ -6,6 +6,7 @@ Compile.sh
FEATURES
Makefile
Makefile.in
TAGS
autom4te*.cache
aclocal.m4
bug*
......
2005-05-25 Paolo Bacchilega <paobac@cvs.gnome.org>
* many_files: Code reorganization. Removed gthumb-window.[ch]; created
a base window class in gth-window.c; moved the browser window in
gth-browser.c; Added a viewer window in gth-viewer.c
2005-04-14 Paolo Bacchilega <paobac@cvs.gnome.org>
* libgthumb/print-callbacks.c (IMAGE_SPACE): set to 20 pixels.
......
......@@ -495,6 +495,32 @@
</locale>
</schema>
<schema>
<key>/schemas/apps/gthumb/ui/viewer_width</key>
<applyto>/apps/gthumb/ui/viewer_width</applyto>
<owner>gthumb</owner>
<type>int</type>
<default>690</default>
<locale name="C">
<short></short>
<long>
</long>
</locale>
</schema>
<schema>
<key>/schemas/apps/gthumb/ui/viewer_height</key>
<applyto>/apps/gthumb/ui/viewer_height</applyto>
<owner>gthumb</owner>
<type>int</type>
<default>460</default>
<locale name="C">
<short></short>
<long>
</long>
</locale>
</schema>
<schema>
<key>/schemas/apps/gthumb/ui/image_pane_visible</key>
<applyto>/apps/gthumb/ui/image_pane_visible</applyto>
......
......@@ -77,6 +77,8 @@
#define PREF_UI_TOOLBAR_STYLE "/apps/gthumb/ui/toolbar_style"
#define PREF_UI_WINDOW_WIDTH "/apps/gthumb/ui/window_width"
#define PREF_UI_WINDOW_HEIGHT "/apps/gthumb/ui/window_height"
#define PREF_UI_VIEWER_WIDTH "/apps/gthumb/ui/viewer_width"
#define PREF_UI_VIEWER_HEIGHT "/apps/gthumb/ui/viewer_height"
#define PREF_UI_IMAGE_PANE_VISIBLE "/apps/gthumb/ui/image_pane_visible"
#define PREF_UI_TOOLBAR_VISIBLE "/apps/gthumb/ui/toolbar_visible"
#define PREF_UI_STATUSBAR_VISIBLE "/apps/gthumb/ui/statusbar_visible"
......
......@@ -26,8 +26,6 @@ INCLUDES = \
bin_PROGRAMS = gthumb
gthumb_SOURCES = \
actions.c \
actions.h \
auto-completion.c \
auto-completion.h \
bookmark-list.c \
......@@ -74,8 +72,12 @@ gthumb_SOURCES = \
dlg-write-to-cd.h \
e-combo-button.c \
e-combo-button.h \
fullscreen.c \
fullscreen.h \
gth-browser.c \
gth-browser.h \
gth-browser-actions-entries.h \
gth-browser-actions-callbacks.h \
gth-browser-actions-callbacks.c \
gth-browser-ui.h \
gth-image-selector.c \
gth-image-selector.h \
gth-exif-data-viewer.c \
......@@ -86,17 +88,24 @@ gthumb_SOURCES = \
gth-folder-selection-dialog.h \
gth-toggle-button.c \
gth-toggle-button.h \
gth-viewer.c \
gth-viewer.h \
gth-viewer-actions-entries.h \
gth-viewer-actions-callbacks.h \
gth-viewer-actions-callbacks.c \
gth-viewer-ui.h \
gth-window.c \
gth-window.h \
gth-window-actions-callbacks.h \
gth-window-actions-callbacks.c \
gtkorientationbox.c \
gtkorientationbox.h \
gthumb-preloader.c \
gthumb-preloader.h \
gthumb-window.c \
gthumb-window.h \
gtkcellrendererthreestates.h \
gtkcellrendererthreestates.c \
main.c \
main.h \
ui.h
main.h
gthumb_LDADD = \
$(EXIF_LIBS) \
......
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* GThumb
*
* Copyright (C) 2004 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
*/
#ifndef ACTIONS_H
#define ACTIONS_H
#include <gtk/gtkaction.h>
#define DEFINE_ACTION(x) void x (GtkAction *action, gpointer data);
DEFINE_ACTION(activate_action_file_new_window)
DEFINE_ACTION(activate_action_file_close_window)
DEFINE_ACTION(activate_action_file_open_with)
DEFINE_ACTION(activate_action_file_save)
DEFINE_ACTION(activate_action_file_revert)
DEFINE_ACTION(activate_action_file_image_properties)
DEFINE_ACTION(activate_action_file_print)
DEFINE_ACTION(activate_action_file_camera_import)
DEFINE_ACTION(activate_action_file_write_to_cd)
DEFINE_ACTION(activate_action_image_open_with)
DEFINE_ACTION(activate_action_image_rename)
DEFINE_ACTION(activate_action_image_duplicate)
DEFINE_ACTION(activate_action_image_delete)
DEFINE_ACTION(activate_action_image_copy)
DEFINE_ACTION(activate_action_image_move)
DEFINE_ACTION(activate_action_edit_rename_file)
DEFINE_ACTION(activate_action_edit_duplicate_file)
DEFINE_ACTION(activate_action_edit_delete_files)
DEFINE_ACTION(activate_action_edit_copy_files)
DEFINE_ACTION(activate_action_edit_move_files)
DEFINE_ACTION(activate_action_edit_select_all)
DEFINE_ACTION(activate_action_edit_edit_comment)
DEFINE_ACTION(activate_action_edit_delete_comment)
DEFINE_ACTION(activate_action_edit_edit_categories)
DEFINE_ACTION(activate_action_edit_add_to_catalog)
DEFINE_ACTION(activate_action_edit_remove_from_catalog)
DEFINE_ACTION(activate_action_edit_catalog_rename)
DEFINE_ACTION(activate_action_edit_catalog_delete)
DEFINE_ACTION(activate_action_edit_catalog_move)
DEFINE_ACTION(activate_action_edit_catalog_edit_search)
DEFINE_ACTION(activate_action_edit_catalog_redo_search)
DEFINE_ACTION(activate_action_edit_current_catalog_new)
DEFINE_ACTION(activate_action_edit_current_catalog_new_library)
DEFINE_ACTION(activate_action_edit_current_catalog_rename)
DEFINE_ACTION(activate_action_edit_current_catalog_delete)
DEFINE_ACTION(activate_action_edit_current_catalog_move)
DEFINE_ACTION(activate_action_edit_current_catalog_edit_search)
DEFINE_ACTION(activate_action_edit_current_catalog_redo_search)
DEFINE_ACTION(activate_action_edit_dir_view)
DEFINE_ACTION(activate_action_edit_dir_view_new_window)
DEFINE_ACTION(activate_action_edit_dir_open)
DEFINE_ACTION(activate_action_edit_dir_rename)
DEFINE_ACTION(activate_action_edit_dir_delete)
DEFINE_ACTION(activate_action_edit_dir_copy)
DEFINE_ACTION(activate_action_edit_dir_move)
DEFINE_ACTION(activate_action_edit_dir_categories)
DEFINE_ACTION(activate_action_edit_current_dir_open)
DEFINE_ACTION(activate_action_edit_current_dir_rename)
DEFINE_ACTION(activate_action_edit_current_dir_delete)
DEFINE_ACTION(activate_action_edit_current_dir_copy)
DEFINE_ACTION(activate_action_edit_current_dir_move)
DEFINE_ACTION(activate_action_edit_current_dir_categories)
DEFINE_ACTION(activate_action_edit_current_dir_new)
DEFINE_ACTION(activate_action_alter_image_rotate90)
DEFINE_ACTION(activate_action_alter_image_rotate90cc)
DEFINE_ACTION(activate_action_alter_image_flip)
DEFINE_ACTION(activate_action_alter_image_mirror)
DEFINE_ACTION(activate_action_alter_image_desaturate)
DEFINE_ACTION(activate_action_alter_image_invert)
DEFINE_ACTION(activate_action_alter_image_adjust_levels)
DEFINE_ACTION(activate_action_alter_image_equalize)
DEFINE_ACTION(activate_action_alter_image_normalize)
DEFINE_ACTION(activate_action_alter_image_stretch_contrast)
DEFINE_ACTION(activate_action_alter_image_posterize)
DEFINE_ACTION(activate_action_alter_image_brightness_contrast)
DEFINE_ACTION(activate_action_alter_image_hue_saturation)
DEFINE_ACTION(activate_action_alter_image_color_balance)
DEFINE_ACTION(activate_action_alter_image_threshold)
DEFINE_ACTION(activate_action_alter_image_resize)
DEFINE_ACTION(activate_action_alter_image_rotate)
DEFINE_ACTION(activate_action_alter_image_crop)
DEFINE_ACTION(activate_action_view_next_image)
DEFINE_ACTION(activate_action_view_prev_image)
DEFINE_ACTION(activate_action_view_zoom_in)
DEFINE_ACTION(activate_action_view_zoom_out)
DEFINE_ACTION(activate_action_view_zoom_100)
DEFINE_ACTION(activate_action_view_zoom_fit)
DEFINE_ACTION(activate_action_view_step_animation)
DEFINE_ACTION(activate_action_view_fullscreen)
DEFINE_ACTION(activate_action_view_exit_fullscreen)
DEFINE_ACTION(activate_action_view_image_prop)
DEFINE_ACTION(activate_action_go_back)
DEFINE_ACTION(activate_action_go_forward)
DEFINE_ACTION(activate_action_go_up)
DEFINE_ACTION(activate_action_go_refresh)
DEFINE_ACTION(activate_action_go_stop)
DEFINE_ACTION(activate_action_go_home)
DEFINE_ACTION(activate_action_go_to_container)
DEFINE_ACTION(activate_action_go_delete_history)
DEFINE_ACTION(activate_action_go_location)
DEFINE_ACTION(activate_action_bookmarks_add)
DEFINE_ACTION(activate_action_bookmarks_edit)
DEFINE_ACTION(activate_action_wallpaper_centered)
DEFINE_ACTION(activate_action_wallpaper_tiled)
DEFINE_ACTION(activate_action_wallpaper_scaled)
DEFINE_ACTION(activate_action_wallpaper_stretched)
DEFINE_ACTION(activate_action_wallpaper_restore)
DEFINE_ACTION(activate_action_tools_slideshow)
DEFINE_ACTION(activate_action_tools_find_images)
DEFINE_ACTION(activate_action_tools_index_image)
DEFINE_ACTION(activate_action_tools_web_exporter)
DEFINE_ACTION(activate_action_tools_rename_series)
DEFINE_ACTION(activate_action_tools_convert_format)
DEFINE_ACTION(activate_action_tools_find_duplicates)
DEFINE_ACTION(activate_action_tools_jpeg_rotate)
DEFINE_ACTION(activate_action_tools_preferences)
DEFINE_ACTION(activate_action_tools_change_date)
DEFINE_ACTION(activate_action_help_about)
DEFINE_ACTION(activate_action_help_help)
DEFINE_ACTION(activate_action_help_shortcuts)
DEFINE_ACTION(activate_action_view_toolbar)
DEFINE_ACTION(activate_action_view_statusbar)
DEFINE_ACTION(activate_action_view_thumbnails)
DEFINE_ACTION(activate_action_view_play_animation)
DEFINE_ACTION(activate_action_view_show_preview)
DEFINE_ACTION(activate_action_view_show_info)
DEFINE_ACTION(activate_action_sort_reversed)
#endif /* ACTIONS_H */
......@@ -37,7 +37,7 @@
#include "auto-completion.h"
#include "file-utils.h"
#include "typedefs.h"
#include "gthumb-window.h"
#include "gth-browser.h"
#include "icons/pixbufs.h"
......@@ -50,7 +50,7 @@ enum {
AC_LIST_NUM_COLUMNS
};
GThumbWindow *gthumb_window = NULL;
GthBrowser *current_w = NULL;
static gchar *ac_dir = NULL;
static gchar *ac_path = NULL;
static GList *ac_subdirs = NULL;
......@@ -111,7 +111,7 @@ ac_alternatives_free ()
void
auto_compl_reset ()
auto_compl_reset (void)
{
ac_dir_free ();
ac_path_free ();
......@@ -185,7 +185,7 @@ auto_compl_get_n_alternatives (const char *path)
static gint
get_common_prefix_length ()
get_common_prefix_length (void)
{
int n;
GList *scan;
......@@ -225,7 +225,7 @@ get_common_prefix_length ()
gchar *
auto_compl_get_common_prefix ()
auto_compl_get_common_prefix (void)
{
char *alternative;
int n;
......@@ -244,7 +244,7 @@ auto_compl_get_common_prefix ()
GList *
auto_compl_get_alternatives ()
auto_compl_get_alternatives (void)
{
return ac_alternatives;
}
......@@ -303,10 +303,10 @@ ac_list_row_activated_cb (GtkTreeView *tree_view,
auto_compl_hide_alternatives ();
if (gthumb_window->sidebar_content == GTH_SIDEBAR_DIR_LIST)
window_go_to_directory (gthumb_window, full_path);
if (gth_browser_get_sidebar_content (current_w) == GTH_SIDEBAR_DIR_LIST)
gth_browser_go_to_directory (current_w, full_path);
else
window_go_to_catalog_directory (gthumb_window, full_path);
gth_browser_go_to_catalog_directory (current_w, full_path);
g_free (full_path);
g_free (name);
......@@ -393,15 +393,15 @@ add_columns (GtkTreeView *treeview)
/* displays a list of alternatives under the entry widget. */
void
auto_compl_show_alternatives (GThumbWindow *window,
GtkWidget *entry)
auto_compl_show_alternatives (GthBrowser *browser,
GtkWidget *entry)
{
GdkPixbuf *pixbuf;
int x, y, w, h;
GList *scan;
int n, width;
gthumb_window = window;
current_w = browser;
if (ac_window == NULL) {
GtkWidget *scroll;
......@@ -452,7 +452,10 @@ auto_compl_show_alternatives (GThumbWindow *window,
width = 0;
n = 0;
pixbuf = (window->sidebar_content == GTH_SIDEBAR_DIR_LIST) ? get_folder_pixbuf (get_folder_pixbuf_size_for_list (window->app)) : gdk_pixbuf_new_from_inline (-1, library_19_rgba, FALSE, NULL);
if (gth_browser_get_sidebar_content (current_w) == GTH_SIDEBAR_DIR_LIST)
pixbuf = get_folder_pixbuf (get_folder_pixbuf_size_for_list (GTK_WIDGET (current_w)));
else
pixbuf = gdk_pixbuf_new_from_inline (-1, library_19_rgba, FALSE, NULL);
gtk_list_store_clear (ac_list_store);
for (scan = ac_alternatives; scan; scan = scan->next) {
......
......@@ -25,23 +25,15 @@
#include <glib.h>
#include <gtk/gtkwidget.h>
#include "gthumb-window.h"
void auto_compl_reset ();
#include "gth-browser.h"
void auto_compl_reset (void);
int auto_compl_get_n_alternatives (const char *path);
char * auto_compl_get_common_prefix ();
GList * auto_compl_get_alternatives ();
void auto_compl_show_alternatives (GThumbWindow *window,
GtkWidget *entry);
void auto_compl_hide_alternatives ();
gboolean auto_compl_alternatives_visible ();
char * auto_compl_get_common_prefix (void);
GList * auto_compl_get_alternatives (void);
void auto_compl_show_alternatives (GthBrowser *browser,
GtkWidget *entry);
void auto_compl_hide_alternatives (void);
gboolean auto_compl_alternatives_visible (void);
#endif /* AUTO_COMPLETION_H */
......@@ -22,6 +22,7 @@
#include <string.h>
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include "main.h"
#include "gthumb-init.h"
......
......@@ -22,6 +22,8 @@
#include <stdio.h>
#include <string.h>
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include "typedefs.h"
......
......@@ -24,6 +24,7 @@
#include <stdio.h>
#include <string.h>
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include <gdk/gdkx.h>
#include <gdk/gdkrgb.h>
......
......@@ -29,6 +29,7 @@
#include <locale.h>
#include <ctype.h>
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include <libgnomevfs/gnome-vfs-utils.h>
#include <libgnomevfs/gnome-vfs-directory.h>
......@@ -352,8 +353,8 @@ catalog_web_exporter_get_type ()
CatalogWebExporter *
catalog_web_exporter_new (GThumbWindow *window,
GList *file_list)
catalog_web_exporter_new (GthWindow *window,
GList *file_list)
{
CatalogWebExporter *ce;
GList *scan;
......@@ -1505,7 +1506,7 @@ export__copy_to_destination__step2 (GnomeVFSResult result,
debug (DEBUG_INFO, "result: %s", gnome_vfs_result_to_string (result));
if (result != GNOME_VFS_OK)
_gtk_error_dialog_run (GTK_WINDOW (ce->window->app),
_gtk_error_dialog_run (GTK_WINDOW (ce->window),
gnome_vfs_result_to_string (result));
dlg_folder_delete (ce->window,
......@@ -2367,7 +2368,7 @@ catalog_web_exporter_export (CatalogWebExporter *ce)
ce->tmp_location = get_temp_dir_name ();
if (ce->tmp_location == NULL) {
_gtk_error_dialog_run (GTK_WINDOW (ce->window->app), _("Could not create a temporary folder"));
_gtk_error_dialog_run (GTK_WINDOW (ce->window), _("Could not create a temporary folder"));
g_signal_emit (G_OBJECT (ce), catalog_web_exporter_signals[WEB_EXPORTER_DONE], 0);
return;
}
......
......@@ -26,7 +26,7 @@
#include <glib.h>
#include <gtk/gtk.h>
#include <gtk/gtkenums.h> /* for GtkSortType */
#include "gthumb-window.h"
#include "gth-window.h"
#include "image-loader.h"
#include "typedefs.h"
......@@ -46,7 +46,7 @@ struct _CatalogWebExporter {
/*< private >*/
GThumbWindow *window;
GthWindow *window;
GList *file_list; /* char* elements. */
GList *album_files;
......@@ -125,7 +125,7 @@ struct _CatalogWebExporterClass {
GType catalog_web_exporter_get_type (void);
CatalogWebExporter * catalog_web_exporter_new (GThumbWindow *window,
CatalogWebExporter * catalog_web_exporter_new (GthWindow *window,
GList *file_list);
void catalog_web_exporter_set_header (CatalogWebExporter *ce,
......
......@@ -23,6 +23,7 @@
#include <config.h>
#include <string.h>
#include <glib/gi18n.h>
#include <libgnomevfs/gnome-vfs-types.h>
#include <libgnomevfs/gnome-vfs-async-ops.h>
......
......@@ -30,39 +30,39 @@
#include "bookmarks.h"
#include "bookmark-list.h"
#include "main.h"
#include "gthumb-window.h"
#include "gth-browser.h"
#define GLADE_FILE "gthumb.glade"
typedef struct {
GThumbWindow *window;
GthBrowser *browser;
GladeXML *gui;
GtkWidget *dialog;
GladeXML *gui;
GtkWidget *dialog;
GtkWidget *list_container;
GtkWidget *btn_remove;
GtkWidget *btn_ok;
GtkWidget *up_button;
GtkWidget *down_button;
GtkWidget *bottom_button;
GtkWidget *top_button;
GtkWidget *list_container;
GtkWidget *btn_remove;
GtkWidget *btn_ok;
GtkWidget *up_button;
GtkWidget *down_button;
GtkWidget *bottom_button;
GtkWidget *top_button;
BookmarkList *book_list;
Bookmarks *bookmarks;
Bookmarks *bookmarks;
gboolean do_not_update;
gboolean do_not_update;
} DialogData;
/* called when the main dialog is closed. */
static void
destroy_cb (GtkWidget *widget,
destroy_cb (GtkWidget *widget,
DialogData *data)
{
data->window->bookmarks_dlg = NULL;
gth_browser_set_bookmarks_dlg (data->browser, NULL);
g_object_unref (G_OBJECT (data->gui));
bookmark_list_free (data->book_list);
......@@ -259,19 +259,19 @@ move_bottom_cb (GtkWidget *widget,
void
dlg_edit_bookmarks (GThumbWindow *window)
dlg_edit_bookmarks (GthBrowser *browser)
{
DialogData *data;
GtkWidget *bm_bookmarks_label;
if (window->bookmarks_dlg != NULL) {
gtk_window_present (GTK_WINDOW (window->bookmarks_dlg));
if (gth_browser_get_bookmarks_dlg (browser) != NULL) {
gtk_window_present (GTK_WINDOW (gth_browser_get_bookmarks_dlg (browser)));
return;
}
data = g_new0 (DialogData, 1);
data->window = window;
data->browser = browser;
data->do_not_update = FALSE;
data->gui = glade_xml_new (GTHUMB_GLADEDIR "/" GLADE_FILE, NULL, NULL);
......@@ -283,7 +283,7 @@ dlg_edit_bookmarks (GThumbWindow *window)
/* Get the widgets. */
data->dialog = glade_xml_get_widget (data->gui, "bookmarks_dialog");
window->bookmarks_dlg = data->dialog;
gth_browser_set_bookmarks_dlg (browser, data->dialog);
g_object_set_data (G_OBJECT (data->dialog), "dialog_data", data);
data->list_container = glade_xml_get_widget (data->gui, "bm_list_container");
......@@ -348,7 +348,7 @@ dlg_edit_bookmarks (GThumbWindow *window)
/* run dialog. */
gtk_window_set_transient_for (GTK_WINDOW (data->dialog),
GTK_WINDOW (window->app));
GTK_WINDOW (browser));
gtk_window_set_modal (GTK_WINDOW (data->dialog), FALSE);
gtk_widget_show_all (data->dialog);
}
......
......@@ -23,10 +23,10 @@
#ifndef DLG_BOOKMARKS_H
#define DLG_BOOKMARKS_H
#include "gthumb-window.h"
#include "gth-browser.h"
void dlg_edit_bookmarks (GThumbWindow *window);
void dlg_edit_bookmarks_update (GtkWidget *dialog);
void dlg_edit_bookmarks (GthBrowser *browser);
void dlg_edit_bookmarks_update (GtkWidget *dialog);
#endif /* DLG_BOOKMARKS_H */
......@@ -31,7 +31,7 @@
#include "async-pixbuf-ops.h"
#include "gth-pixbuf-op.h"
#include "gthumb-window.h"
#include "gth-window.h"
#include "gthumb-stock.h"
#include "pixbuf-utils.h"
......@@ -42,7 +42,7 @@
typedef struct {
GThumbWindow *window;
GthWindow *window;
ImageViewer *viewer;
GdkPixbuf *image;
GdkPixbuf *orig_pixbuf;
......@@ -109,7 +109,7 @@ apply_changes (DialogData *data,
data);
gth_pixbuf_op_start (pixop);