/*
- * Geeqie
- * (C) 2004 John Ellis
- * Copyright (C) 2008 - 2012 The Geeqie Team
+ * Copyright (C) 2004 John Ellis
+ * Copyright (C) 2008 - 2016 The Geeqie Team
*
* Author: Vladimir Nadvornik
*
- * This software is released under the GNU General Public License (GNU GPL).
- * Please read the included file COPYING for more information.
- * This software comes with no warranty of any kind, use at your own risk!
+ * 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.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-
#include "main.h"
#include "bar.h"
" </layout>"
"</gq>";
+static const gchar default_config_headline[] =
+"<gq>"
+" <layout id = '_current_'>"
+" <bar>"
+" <pane_comment id = 'headline' expanded = 'true' key = 'Xmp.photoshop.Headline' height = '40' />"
+" </bar>"
+" </layout>"
+"</gq>";
+
static const gchar default_config_keywords[] =
"<gq>"
" <layout id = '_current_'>"
" </bar>"
" </layout>"
"</gq>";
+static const gchar default_config_rating[] =
+"<gq>"
+" <layout id = '_current_'>"
+" <bar>"
+" <pane_comment id = 'rating' expanded = 'true' key = '" RATING_KEY "' height = '10' />"
+" </bar>"
+" </layout>"
+"</gq>";
static const gchar default_config_exif[] =
"<gq>"
" <pane_exif id = 'exif' expanded = 'true' >"
" <entry key = 'formatted.Camera' if_set = 'true' editable = 'false' />"
" <entry key = 'formatted.DateTime' if_set = 'true' editable = 'false' />"
+" <entry key = 'formatted.localtime' if_set = 'true' editable = 'false' />"
" <entry key = 'formatted.ShutterSpeed' if_set = 'true' editable = 'false' />"
" <entry key = 'formatted.Aperture' if_set = 'true' editable = 'false' />"
" <entry key = 'formatted.ExposureBias' if_set = 'true' editable = 'false' />"
" <entry key = 'formatted.SubjectDistance' if_set = 'true' editable = 'false' />"
" <entry key = 'formatted.Resolution' if_set = 'true' editable = 'false' />"
" <entry key = '" ORIENTATION_KEY "' if_set = 'true' editable = 'false' />"
+" <entry key = 'formatted.star_rating' if_set = 'true' editable = 'false' />"
" </pane_exif>"
" </bar>"
" </layout>"
" <entry key = 'file.mode' if_set = 'false' editable = 'false' />"
" <entry key = 'file.date' if_set = 'false' editable = 'false' />"
" <entry key = 'file.size' if_set = 'false' editable = 'false' />"
+" <entry key = 'file.owner' if_set = 'false' editable = 'false' />"
+" <entry key = 'file.group' if_set = 'false' editable = 'false' />"
+" <entry key = 'file.class' if_set = 'false' editable = 'false' />"
+" <entry key = 'file.link' if_set = 'false' editable = 'false' />"
" </pane_exif>"
" </bar>"
" </layout>"
" <pane_exif id = 'location' expanded = 'true' >"
" <entry key = 'formatted.GPSPosition' if_set = 'true' editable = 'false' />"
" <entry key = 'formatted.GPSAltitude' if_set = 'true' editable = 'false' />"
+" <entry key = 'formatted.timezone' if_set = 'true' editable = 'false' />"
" <entry key = 'Xmp.photoshop.Country' if_set = 'false' editable = 'true' />"
" <entry key = 'Xmp.iptc.CountryCode' if_set = 'false' editable = 'true' />"
" <entry key = 'Xmp.photoshop.State' if_set = 'false' editable = 'true' />"
{PANE_COMMENT, "title", N_("Title"), default_config_title},
{PANE_KEYWORDS, "keywords", N_("Keywords"), default_config_keywords},
{PANE_COMMENT, "comment", N_("Comment"), default_config_comment},
+ {PANE_COMMENT, "rating", N_("Rating"), default_config_rating},
+ {PANE_COMMENT, "headline", N_("Headline"), default_config_headline},
{PANE_EXIF, "exif", N_("Exif"), default_config_exif},
/* other pre-configured panes */
{PANE_EXIF, "file_info", N_("File info"), default_config_file_info},
GtkWidget *vbox;
FileData *fd;
GtkWidget *label_file_name;
+ GtkWidget *add_button;
LayoutWindow *lw;
gint width;
gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, bar, 0, GDK_CURRENT_TIME);
}
+static void bar_menu_add_popup(GtkWidget *widget)
+{
+ GtkWidget *menu;
+ GtkWidget *bar;
+ const KnownPanes *pane = known_panes;
+
+ bar = widget;
+
+ menu = popup_menu_short_lived();
+
+ while (pane->id)
+ {
+ GtkWidget *item;
+ item = menu_item_add_stock(menu, _(pane->title), GTK_STOCK_ADD, G_CALLBACK(bar_expander_add_cb), bar);
+ g_object_set_data(G_OBJECT(item), "pane_add_id", pane->id);
+ pane++;
+ }
+
+ gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, bar, 0, GDK_CURRENT_TIME);
+}
+
static gboolean bar_menu_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data)
{
return FALSE;
}
+static void bar_expander_cb(GObject *object, GParamSpec *param_spec, gpointer data)
+{
+ GtkExpander *expander;
+ GtkWidget *child;
+
+ expander = GTK_EXPANDER(object);
+ child = gtk_bin_get_child(GTK_BIN(expander));
+
+ if (gtk_expander_get_expanded(expander))
+ {
+ gtk_widget_show_all(child);
+ }
+ else
+ {
+ gtk_widget_hide(child);
+ }
+}
+
+static gboolean bar_menu_add_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data)
+{
+ bar_menu_add_popup(widget);
+ return TRUE;
+}
+
static void bar_pane_set_fd_cb(GtkWidget *expander, gpointer data)
{
pd->bar = bar;
expander = gtk_expander_new(NULL);
+ DEBUG_NAME(expander);
if (pd && pd->title)
{
gtk_expander_set_label_widget(GTK_EXPANDER(expander), pd->title);
gtk_box_pack_start(GTK_BOX(bd->vbox), expander, FALSE, TRUE, 0);
g_signal_connect(expander, "button_release_event", G_CALLBACK(bar_menu_cb), bd);
+ g_signal_connect(expander, "notify::expanded", G_CALLBACK(bar_expander_cb), pd);
gtk_container_add(GTK_CONTAINER(expander), pane);
void bar_populate_default(GtkWidget *bar)
{
- const gchar *populate_id[] = {"histogram", "title", "keywords", "comment", "exif", NULL};
+ const gchar *populate_id[] = {"histogram", "title", "keywords", "comment", "rating", "exif", NULL};
const gchar **id = populate_id;
while (*id)
}
#ifdef HAVE_LIBCHAMPLAIN_GTK
-/*
- FIXME: this is an ugly hack that works around this bug:
+/**
+ @FIXME this is an ugly hack that works around this bug:
https://bugzilla.gnome.org/show_bug.cgi?id=590692
http://bugzilla.openedhand.com/show_bug.cgi?id=1751
it should be removed as soon as a better solution exists
BarData *bd;
GtkWidget *box;
GtkWidget *scrolled;
+ GtkWidget *tbar;
+ GtkWidget *add_box;
bd = g_new0(BarData, 1);
bd->lw = lw;
bd->widget = gtk_vbox_new(FALSE, PREF_PAD_GAP);
+ DEBUG_NAME(bd->widget);
g_object_set_data(G_OBJECT(bd->widget), "bar_data", bd);
g_signal_connect(G_OBJECT(bd->widget), "destroy",
G_CALLBACK(bar_destroy), bd);
gtk_widget_set_size_request(bd->widget, bd->width, -1);
box = gtk_hbox_new(FALSE, 0);
+ DEBUG_NAME(box);
bd->label_file_name = gtk_label_new("");
gtk_label_set_ellipsize(GTK_LABEL(bd->label_file_name), PANGO_ELLIPSIZE_END);
gtk_label_set_selectable(GTK_LABEL(bd->label_file_name), TRUE);
+#if GTK_CHECK_VERSION(3,16,0)
+ gtk_label_set_xalign(GTK_LABEL(bd->label_file_name), 0.5);
+ gtk_label_set_yalign(GTK_LABEL(bd->label_file_name), 0.5);
+#else
gtk_misc_set_alignment(GTK_MISC(bd->label_file_name), 0.5, 0.5);
+#endif
gtk_box_pack_start(GTK_BOX(box), bd->label_file_name, TRUE, TRUE, 0);
gtk_widget_show(bd->label_file_name);
gtk_widget_show(box);
scrolled = gtk_scrolled_window_new(NULL, NULL);
+ DEBUG_NAME(scrolled);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled),
GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
gtk_box_pack_start(GTK_BOX(bd->widget), scrolled, TRUE, TRUE, 0);
gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolled), bd->vbox);
gtk_viewport_set_shadow_type(GTK_VIEWPORT(gtk_bin_get_child(GTK_BIN(scrolled))), GTK_SHADOW_NONE);
+ add_box = gtk_vbox_new(FALSE, 0);
+ DEBUG_NAME(add_box);
+ gtk_box_pack_end(GTK_BOX(bd->widget), add_box, FALSE, FALSE, 0);
+ tbar = pref_toolbar_new(add_box, GTK_TOOLBAR_ICONS);
+ bd->add_button = pref_toolbar_button(tbar, GTK_STOCK_ADD, NULL, FALSE,
+ _("Add Pane"),
+ G_CALLBACK(bar_menu_add_cb), bd);
+ gtk_widget_show(add_box);
+
#ifdef HAVE_LIBCHAMPLAIN_GTK
g_signal_connect(G_OBJECT(gtk_bin_get_child(GTK_BIN(scrolled))), "unrealize", G_CALLBACK(bar_unrealize_clutter_fix_cb), NULL);
#endif
log_printf("unknown attribute %s = %s\n", option, value);
}
+#if !GTK_CHECK_VERSION(3,0,0)
+/** @FIXME In bar_size_allocate() the width obtained is the allocated width. In GTK2 this
+ * is the actual width. In GTK3 it is the *minimum* width.
+ * This results in the info sidebar being able to increase, but not
+ * decrease. There does not seem to be a way in GTK3 to get the actual width of
+ * a widget. For GTK3 the only way is to disable it. The width of the sidebar
+ * is therefore not preserved across restarts.
+ */
gtk_widget_set_size_request(bar, width, -1);
+#endif
if (enabled)
{
gtk_widget_show(bar);
GtkWidget *widget = gtk_label_new(title);
pref_label_bold(widget, TRUE, FALSE);
- //gtk_label_set_ellipsize(GTK_LABEL(widget), PANGO_ELLIPSIZE_END); //FIXME: do not work
+ //gtk_label_set_ellipsize(GTK_LABEL(widget), PANGO_ELLIPSIZE_END);
+ /** @FIXME do not work */
return widget;
}