Commit d2d0c298 authored by Paolo Bacchilega's avatar Paolo Bacchilega
Browse files

Merge branch 'catalog-properties' into ext

parents 2d1d39fc 58540af2
......@@ -10,10 +10,16 @@ libcatalogs_la_SOURCES = \
callbacks.h \
dlg-add-to-catalog.c \
dlg-add-to-catalog.h \
dlg-catalog-properties.c \
dlg-catalog-properties.h \
dlg-organize-files.c \
dlg-organize-files.h \
gth-catalog.c \
gth-catalog.h \
gth-file-source-catalogs.c \
gth-file-source-catalogs.h \
gth-organize-task.c \
gth-organize-task.h \
main.c
libcatalogs_la_CFLAGS = $(GTHUMB_CFLAGS) $(WARNINGS) -I$(top_srcdir) -I$(top_builddir)/gthumb
......
......@@ -25,6 +25,7 @@
#include <gthumb.h>
#include <gth-catalog.h>
#include "dlg-add-to-catalog.h"
#include "dlg-catalog-properties.h"
void
......@@ -354,6 +355,21 @@ gth_browser_activate_action_catalog_rename (GtkAction *action,
}
void
gth_browser_activate_action_catalog_properties (GtkAction *action,
GthBrowser *browser)
{
GthFolderTree *folder_tree;
GthFileData *file_data;
folder_tree = GTH_FOLDER_TREE (gth_browser_get_folder_tree (browser));
file_data = gth_folder_tree_get_selected (folder_tree);
dlg_catalog_properties (browser, file_data);
g_object_unref (file_data);
}
void
gth_browser_activate_action_go_to_container (GtkAction *action,
GthBrowser *browser)
......
......@@ -33,6 +33,7 @@ DEFINE_ACTION(gth_browser_activate_action_catalog_new)
DEFINE_ACTION(gth_browser_activate_action_catalog_new_library)
DEFINE_ACTION(gth_browser_activate_action_catalog_remove)
DEFINE_ACTION(gth_browser_activate_action_catalog_rename)
DEFINE_ACTION(gth_browser_activate_action_catalog_properties)
DEFINE_ACTION(gth_browser_activate_action_go_to_container)
void gth_browser_add_to_catalog (GthBrowser *browser,
......
......@@ -26,10 +26,15 @@
#include <glib-object.h>
#include <gthumb.h>
#include <gth-catalog.h>
#include "dlg-catalog-properties.h"
#include "dlg-organize-files.h"
#include "gth-file-source-catalogs.h"
#include "actions.h"
#define BROWSER_DATA_KEY "catalogs-browser-data"
#define _RESPONSE_PROPERTIES 1
#define _RESPONSE_ORGANIZE 2
static const char *fixed_ui_info =
......@@ -83,6 +88,8 @@ static const gchar *folder_popup_ui_info =
" <separator/>"
" <menuitem action='Catalog_Remove'/>"
" <menuitem action='Catalog_Rename'/>"
" <separator/>"
" <menuitem action='Catalog_Properties'/>"
" </placeholder>"
" </popup>"
"</ui>";
......@@ -129,7 +136,12 @@ static GtkActionEntry catalog_action_entries[] = {
{ "Catalog_Rename", NULL,
N_("Rena_me"), NULL,
NULL,
G_CALLBACK (gth_browser_activate_action_catalog_rename) }
G_CALLBACK (gth_browser_activate_action_catalog_rename) },
{ "Catalog_Properties", GTK_STOCK_PROPERTIES,
NULL, NULL,
NULL,
G_CALLBACK (gth_browser_activate_action_catalog_properties) }
};
static guint catalog_action_entries_size = G_N_ELEMENTS (catalog_action_entries);
......@@ -141,6 +153,8 @@ typedef struct {
guint vfs_merge_id;
gboolean catalog_menu_loaded;
guint monitor_events;
GtkWidget *properties_button;
GtkWidget *organize_button;
} BrowserData;
......@@ -311,11 +325,17 @@ sort_catalogs (gconstpointer a,
GthFileData *file_data_a = (GthFileData *) a;
GthFileData *file_data_b = (GthFileData *) b;
if (g_file_info_get_attribute_boolean (file_data_a->info, "gthumb::no-child") != g_file_info_get_attribute_boolean (file_data_b->info, "gthumb::no-child"))
if (g_file_info_get_attribute_boolean (file_data_a->info, "gthumb::no-child") != g_file_info_get_attribute_boolean (file_data_b->info, "gthumb::no-child")) {
/* put the libraries before the catalogs */
return g_file_info_get_attribute_boolean (file_data_a->info, "gthumb::no-child") ? 1 : -1;
else
}
else if (g_file_info_get_sort_order (file_data_a->info) == g_file_info_get_sort_order (file_data_b->info))
return g_utf8_collate (g_file_info_get_display_name (file_data_a->info),
g_file_info_get_display_name (file_data_b->info));
else if (g_file_info_get_sort_order (file_data_a->info) < g_file_info_get_sort_order (file_data_b->info))
return -1;
else
return 1;
}
......@@ -558,6 +578,22 @@ catalogs__gth_browser_folder_tree_popup_before_cb (GthBrowser *browser,
}
static void
properties_button_clicked_cb (GtkButton *button,
GthBrowser *browser)
{
dlg_catalog_properties (browser, gth_browser_get_location_data (browser));
}
static void
organize_button_clicked_cb (GtkButton *button,
GthBrowser *browser)
{
dlg_organize_files (browser, gth_browser_get_location (browser));
}
void
catalogs__gth_browser_load_location_after_cb (GthBrowser *browser,
GthFileData *location_data,
......@@ -588,3 +624,51 @@ catalogs__gth_browser_load_location_after_cb (GthBrowser *browser,
}
}
}
void
catalogs__gth_browser_update_extra_widget_cb (GthBrowser *browser)
{
BrowserData *data;
GthFileData *location_data;
data = g_object_get_data (G_OBJECT (browser), BROWSER_DATA_KEY);
location_data = gth_browser_get_location_data (browser);
if (GTH_IS_FILE_SOURCE_CATALOGS (gth_browser_get_location_source (browser))
&& ! _g_content_type_is_a (g_file_info_get_content_type (location_data->info), "gthumb/library"))
{
GtkWidget *extra_widget;
extra_widget = gth_browser_get_list_extra_widget (browser);
if (data->properties_button == NULL) {
data->properties_button = gtk_button_new ();
gtk_container_add (GTK_CONTAINER (data->properties_button), gtk_image_new_from_stock (GTK_STOCK_PROPERTIES, GTK_ICON_SIZE_BUTTON));
g_object_add_weak_pointer (G_OBJECT (data->properties_button), (gpointer *)&data->properties_button);
gtk_button_set_relief (GTK_BUTTON (data->properties_button), GTK_RELIEF_NONE);
gtk_widget_set_tooltip_text (data->properties_button, _("Properties"));
gtk_widget_show_all (data->properties_button);
gedit_message_area_add_action_widget (GEDIT_MESSAGE_AREA (extra_widget), data->properties_button, _RESPONSE_PROPERTIES);
g_signal_connect (data->properties_button,
"clicked",
G_CALLBACK (properties_button_clicked_cb),
browser);
}
}
else if (GTH_IS_FILE_SOURCE_VFS (gth_browser_get_location_source (browser))) {
if (data->organize_button == NULL) {
data->organize_button = gtk_button_new ();
gtk_container_add (GTK_CONTAINER (data->organize_button), gtk_label_new (_("Organize")));
gtk_widget_set_tooltip_text (data->organize_button, _("Automatically organize files by date"));
g_object_add_weak_pointer (G_OBJECT (data->organize_button), (gpointer *)&data->organize_button);
gtk_button_set_relief (GTK_BUTTON (data->organize_button), GTK_RELIEF_NONE);
gtk_widget_show_all (data->organize_button);
gedit_message_area_add_action_widget (GEDIT_MESSAGE_AREA (gth_browser_get_list_extra_widget (browser)), data->organize_button, _RESPONSE_ORGANIZE);
g_signal_connect (data->organize_button,
"clicked",
G_CALLBACK (organize_button_clicked_cb),
browser);
}
}
}
......@@ -26,17 +26,18 @@
#include <gthumb.h>
#include "gth-catalog.h"
void catalogs__initialize_cb (void);
void catalogs__gth_browser_construct_cb (GthBrowser *browser);
void catalogs__gth_browser_update_sensitivity_cb (GthBrowser *browser);
void catalogs__gth_browser_file_list_popup_before_cb (GthBrowser *browser);
void catalogs__gth_browser_file_popup_before_cb (GthBrowser *browser);
void catalogs__gth_browser_folder_tree_popup_before_cb (GthBrowser *browser,
GthFileSource *file_source,
GFile *folder);
GthCatalog * catalogs__gth_catalog_load_from_data_cb (const void *buffer);
void catalogs__gth_browser_load_location_after_cb (GthBrowser *browser,
GFile *location,
const GError *error);
void catalogs__initialize_cb (void);
void catalogs__gth_browser_construct_cb (GthBrowser *browser);
void catalogs__gth_browser_update_sensitivity_cb (GthBrowser *browser);
void catalogs__gth_browser_file_list_popup_before_cb (GthBrowser *browser);
void catalogs__gth_browser_file_popup_before_cb (GthBrowser *browser);
void catalogs__gth_browser_folder_tree_popup_before_cb (GthBrowser *browser,
GthFileSource *file_source,
GFile *folder);
GthCatalog * catalogs__gth_catalog_load_from_data_cb (const void *buffer);
void catalogs__gth_browser_load_location_after_cb (GthBrowser *browser,
GFile *location,
const GError *error);
void catalogs__gth_browser_update_extra_widget_cb (GthBrowser *browser);
#endif /* CALLBACKS_H */
uidir = $(datadir)/gthumb-2.0/ui
ui_DATA = add-to-catalog.ui
ui_DATA = \
add-to-catalog.ui \
catalog-properties.ui \
organize-files.ui
EXTRA_DIST = $(ui_DATA)
-include $(top_srcdir)/git.mk
<?xml version="1.0"?>
<interface>
<requires lib="gtk+" version="2.16"/>
<!-- interface-naming-policy project-wide -->
<object class="GtkDialog" id="properties_dialog">
<property name="border_width">5</property>
<property name="title" translatable="yes">Properties</property>
<property name="resizable">False</property>
<property name="type_hint">normal</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox1">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="spacing">8</property>
<child>
<object class="GtkVBox" id="main_vbox">
<property name="visible">True</property>
<property name="border_width">5</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child>
<object class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkLabel" id="label4">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Catalog</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
<packing>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkAlignment" id="alignment2">
<property name="visible">True</property>
<property name="left_padding">12</property>
<child>
<object class="GtkTable" id="table1">
<property name="visible">True</property>
<property name="n_rows">2</property>
<property name="n_columns">2</property>
<property name="column_spacing">6</property>
<property name="row_spacing">6</property>
<child>
<object class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_Name:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">name_entry</property>
</object>
<packing>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label3">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_Date:</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="name_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">&#x25CF;</property>
<property name="activates_default">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
</packing>
</child>
<child>
<object class="GtkHBox" id="date_container_box">
<property name="visible">True</property>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
</packing>
</child>
</object>
</child>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
<child internal-child="action_area">
<object class="GtkHButtonBox" id="dialog-action_area1">
<property name="visible">True</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="cancel_button">
<property name="label">gtk-cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="save_button">
<property name="label">gtk-save</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="has_default">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="help_button">
<property name="label">gtk-help</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
<property name="secondary">True</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
</object>
</child>
<action-widgets>
<action-widget response="0">cancel_button</action-widget>
<action-widget response="0">save_button</action-widget>
<action-widget response="0">help_button</action-widget>
</action-widgets>
</object>
</interface>
This diff is collapsed.
<?xml version="1.0"?>
<interface>
<requires lib="gtk+" version="2.16"/>
<!-- interface-naming-policy project-wide -->
<object class="GtkDialog" id="organize_files_dialog">
<property name="border_width">5</property>
<property name="title" translatable="yes">Organize Files</property>
<property name="type_hint">normal</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox1">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child>
<object class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<property name="border_width">5</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child>
<object class="GtkHBox" id="hbox3">
<property name="visible">True</property>
<property name="spacing">12</property>
<child>
<object class="GtkImage" id="icon_image">
<property name="visible">True</property>
<property name="yalign">0</property>
<property name="stock">gtk-dialog-info</property>
<property name="pixel_size">24</property>
<property name="icon-size">6</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkVBox" id="vbox2">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child>
<object class="GtkVBox" id="vbox4">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkAlignment" id="alignment2">
<property name="visible">True</property>
<property name="bottom_padding">6</property>
<child>
<object class="GtkLabel" id="label3">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Files will be organized in catalogs.</property>
<property name="wrap">True</property>
</object>
</child>
</object>
<packing>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkHBox" id="hbox6">
<property name="visible">True</property>
<property name="spacing">6</property>
<child>
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_Group files by:</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkComboBox" id="group_by_combobox">
<property name="visible">True</property>
<property name="model">group_by_liststore</property>
<property name="active">0</property>
<child>
<object class="GtkCellRendererText" id="cellrenderertext1"/>
<attributes>
<attribute name="text">1</attribute>
</attributes>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="include_subfolders_checkbutton">
<property name="label" translatable="yes">_Include sub-folders</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="ignore_singletons_checkbutton">
<property name="label" translatable="yes">Ignore catalogs with a single file</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="position">3</property>
</packing>
</child>
<child>
<object class="GtkAlignment" id="alignment1">
<property name="visible">True</property>
<property name="left_padding">12</property>
<child>
<object class="GtkHBox" id="single_catalog_box">
<property name="visible">True</property>
<property name="spacing">6</property>
<child>
<object class="GtkCheckButton" id="use_singletons_catalog_checkbutton">
<property name="label" translatable="yes">Put single files in the catalog:</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="single_catalog_entry">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="invisible_char">&#x25CF;</property>
<property name="text" translatable="yes">Singles</property>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
<packing>
<property name="position">4</property>
</packing>
</child>
</object>
<packing>
<property name="position">0</property>