* used for the same purposes by the Print routines
*/
-#include "main.h"
#include "osd.h"
+#include <cmath>
+#include <cstdlib>
+#include <cstring>
+
+#include <gdk/gdk.h>
+#include <glib-object.h>
+
+#include <config.h>
+
+#include "compat.h"
#include "dnd.h"
#include "exif.h"
#include "glua.h"
+#include "intl.h"
#include "metadata.h"
-#include "ui-fileops.h"
+#include "typedefs.h"
#include "ui-misc.h"
-#include <cmath>
-
static const gchar *predefined_tags[][2] = {
{"%name%", N_("Name")},
{"%path:60%", N_("Path")},
g_free(td->title);
}
-static void set_osd_button(GtkTable *table, const gint rows, const gint cols, const gchar *key, const gchar *title, GtkWidget *template_view)
+static void set_osd_button(GtkGrid *grid, const gint rows, const gint cols, const gchar *key, const gchar *title, GtkWidget *template_view)
{
GtkWidget *new_button;
TagData *td;
g_signal_connect(G_OBJECT(new_button), "destroy",
G_CALLBACK(osd_btn_destroy_cb), new_button);
- gtk_table_attach_defaults(table, new_button, cols, cols+1, rows, rows+1);
+ gtk_grid_attach(grid, new_button, cols, rows, 1, 1);
}
pref_label_new(vbox, _("To include predefined tags in the template, click a button or drag-and-drop"));
- scrolled = gtk_scrolled_window_new(nullptr, nullptr);
- gtk_box_pack_start(GTK_BOX(vbox), scrolled, FALSE, FALSE, 0);
+ scrolled = gq_gtk_scrolled_window_new(nullptr, nullptr);
+ gq_gtk_box_pack_start(GTK_BOX(vbox), scrolled, FALSE, FALSE, 0);
gtk_container_set_border_width(GTK_CONTAINER(scrolled), PREF_PAD_BORDER);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled),
GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
viewport = gtk_viewport_new(nullptr, nullptr);
gtk_viewport_set_shadow_type(GTK_VIEWPORT(viewport), GTK_SHADOW_NONE);
- gtk_container_add(GTK_CONTAINER(scrolled), viewport);
+ gq_gtk_container_add(GTK_WIDGET(scrolled), viewport);
gtk_widget_show(viewport);
- entries = (sizeof(predefined_tags) / sizeof(predefined_tags[0])) - 1;
+ entries = ((gdouble)sizeof(predefined_tags) / sizeof(predefined_tags[0])) - 1;
max_rows = ceil(entries / max_cols);
- GtkTable *table;
- table = GTK_TABLE(gtk_table_new(max_rows, max_cols, FALSE));
- gtk_container_add(GTK_CONTAINER(viewport), GTK_WIDGET(table));
- gtk_widget_show(GTK_WIDGET(table));
+ GtkGrid *grid;
+ grid = GTK_GRID(gtk_grid_new());
+ gq_gtk_container_add(GTK_WIDGET(viewport), GTK_WIDGET(grid));
+ gtk_widget_show(GTK_WIDGET(grid));
for (rows = 0; rows < max_rows; rows++)
{
while (cols < max_cols && predefined_tags[i][0])
{
- set_osd_button(table, rows, cols, predefined_tags[i][0], predefined_tags[i][1], template_view);
+ set_osd_button(grid, rows, cols, predefined_tags[i][0], predefined_tags[i][1], template_view);
i = i + 1;
cols++;
}
gchar *image_osd_mkinfo(const gchar *str, FileData *fd, GHashTable *vars)
{
- gchar delim = '%', imp = '|', sep[] = " - ";
- gchar *start, *end;
- guint pos, prev;
+ gchar delim = '%';
+ gchar imp = '|';
+ gchar sep[] = " - ";
+ gchar *start;
+ gchar *end;
+ guint pos;
+ guint prev;
gboolean want_separator = FALSE;
- gchar *name, *data;
+ gchar *name;
+ gchar *data;
GString *osd_info;
gchar *ret;
{
data = metadata_read_string(fd, RATING_KEY, METADATA_PLAIN);
}
-#ifdef HAVE_LUA
+#if HAVE_LUA
else if (strncmp(name, "lua/", 4) == 0)
{
gchar *tmp;
* Examples:
* "<i>*</i>\n" -> data is displayed in italics ended with a newline
* "\n" -> ended with newline
- * "ISO *" -> prefix data with "ISO " (ie. "ISO 100")
+ * 'ISO *' -> prefix data with 'ISO ' (ie. 'ISO 100')
* "\**\*" -> prefix data with a star, and append a star (ie. "*100*")
* "\\*" -> prefix data with an anti slash (ie "\100")
- * "Collection <b>*</b>\n" -> display data in bold prefixed by "Collection " and a newline is appended
+ * 'Collection <b>*</b>\n' -> display data in bold prefixed by 'Collection ' and a newline is appended
*/
/** @FIXME using background / foreground colors lead to weird results.
*/
g_hash_table_insert(vars, const_cast<gchar *>(keyword), const_cast<gchar *>(value));
return;
}
- else
- {
- g_hash_table_insert(vars, const_cast<gchar *>(keyword), g_strdup(value));
- }
+
+ g_hash_table_insert(vars, const_cast<gchar *>(keyword), g_strdup(value));
if (flags & OSDT_FREE) g_free(const_cast<gchar *>(value));
}