Import newer upstream.

This commit is contained in:
Cassowary 2023-09-25 16:54:03 -07:00
parent a8611b8b16
commit 098531073c
66 changed files with 13399 additions and 10203 deletions

View File

@ -1,6 +1,6 @@
-- This file is generated from authors.xml, do not edit it directly. --
PIKA was originally written by:
GIMP was originally written by:
Spencer Kimball
Peter Mattis
@ -12,7 +12,7 @@ The current maintainers are:
Jehan
The following people have contributed code to PIKA:
The following people have contributed code to GIMP:
Lauri Alanko
Fredrik Alströmer
@ -339,7 +339,7 @@ The following people have contributed code to PIKA:
Robert Ögren
The following people have contributed art to PIKA:
The following people have contributed art to GIMP:
Lapo Calamandrei
Paul Davey
@ -359,7 +359,7 @@ The following people have contributed art to PIKA:
William Szilveszter
The following people have helped to document PIKA:
The following people have helped to document GIMP:
Ignacio AntI
Žygimantas Beručka

View File

@ -371,66 +371,86 @@ static const PikaEnumActionEntry view_zoom_actions[] =
PIKA_HELP_VIEW_ZOOM_IN }
};
static const PikaRadioActionEntry view_zoom_explicit_actions[] =
static const PikaEnumActionEntry view_zoom_explicit_actions[] =
{
{ "view-zoom-16-1", NULL,
NC_("view-zoom-action", "1_6:1 (1600%)"), NULL, { "5", "KP_5", NULL },
NC_("view-zoom-action", "Zoom 16:1 (1600%)"),
NC_("view-zoom-action", "1_6:1 (1600%)"),
{ "5", "KP_5", NULL },
NC_("view-zoom-action", "Zoom 16:1"),
160000,
160000, FALSE,
PIKA_HELP_VIEW_ZOOM_IN },
{ "view-zoom-8-1", NULL,
NC_("view-zoom-action", "_8:1 (800%)"), NULL, { "4", "KP_4", NULL },
NC_("view-zoom-action", "Zoom 8:1 (800%)"),
NC_("view-zoom-action", "_8:1 (800%)"),
{ "4", "KP_4", NULL },
NC_("view-zoom-action", "Zoom 8:1"),
80000,
80000, FALSE,
PIKA_HELP_VIEW_ZOOM_IN },
{ "view-zoom-4-1", NULL,
NC_("view-zoom-action", "_4:1 (400%)"), NULL, { "3", "KP_3", NULL },
NC_("view-zoom-action", "Zoom 4:1 (400%)"),
NC_("view-zoom-action", "_4:1 (400%)"),
{ "3", "KP_3", NULL },
NC_("view-zoom-action", "Zoom 4:1"),
40000,
40000, FALSE,
PIKA_HELP_VIEW_ZOOM_IN },
{ "view-zoom-2-1", NULL,
NC_("view-zoom-action", "_2:1 (200%)"), NULL, { "2", "KP_2", NULL },
NC_("view-zoom-action", "Zoom 2:1 (200%)"),
NC_("view-zoom-action", "_2:1 (200%)"),
{ "2", "KP_2", NULL },
NC_("view-zoom-action", "Zoom 2:1"),
20000,
20000, FALSE,
PIKA_HELP_VIEW_ZOOM_IN },
{ "view-zoom-1-1", PIKA_ICON_ZOOM_ORIGINAL,
NC_("view-zoom-action", "_1:1 (100%)"), NULL, { "1", "KP_1", NULL },
NC_("view-zoom-action", "Zoom 1:1 (100%)"),
NC_("view-zoom-action", "_1:1 (100%)"),
{ "1", "KP_1", NULL },
NC_("view-zoom-action", "Zoom 1:1"),
10000,
10000, FALSE,
PIKA_HELP_VIEW_ZOOM_100 },
{ "view-zoom-1-2", NULL,
NC_("view-zoom-action", "1:_2 (50%)"), NULL, { "<shift>2", "<shift>KP_2", NULL },
NC_("view-zoom-action", "Zoom 1:2 (50%)"),
NC_("view-zoom-action", "1:_2 (50%)"),
{ "<shift>2", "<shift>KP_2", NULL },
NC_("view-zoom-action", "Zoom 1:2"),
5000,
5000, FALSE,
PIKA_HELP_VIEW_ZOOM_OUT },
{ "view-zoom-1-4", NULL,
NC_("view-zoom-action", "1:_4 (25%)"), NULL, { "<shift>3", "<shift>KP_3", NULL },
NC_("view-zoom-action", "Zoom 1:4 (25%)"),
NC_("view-zoom-action", "1:_4 (25%)"),
{ "<shift>3", "<shift>KP_3", NULL },
NC_("view-zoom-action", "Zoom 1:4"),
2500,
2500, FALSE,
PIKA_HELP_VIEW_ZOOM_OUT },
{ "view-zoom-1-8", NULL,
NC_("view-zoom-action", "1:_8 (12.5%)"), NULL, { "<shift>4", "<shift>KP_4", NULL },
NC_("view-zoom-action", "Zoom 1:8 (12.5%)"),
NC_("view-zoom-action", "1:_8 (12.5%)"),
{ "<shift>4", "<shift>KP_4", NULL },
NC_("view-zoom-action", "Zoom 1:8"),
1250,
1250, FALSE,
PIKA_HELP_VIEW_ZOOM_OUT },
{ "view-zoom-1-16", NULL,
NC_("view-zoom-action", "1:1_6 (6.25%)"), NULL, { "<shift>5", "<shift>KP_5", NULL },
NC_("view-zoom-action", "Zoom 1:16 (6.25%)"),
NC_("view-zoom-action", "1:1_6 (6.25%)"),
{ "<shift>5", "<shift>KP_5", NULL },
NC_("view-zoom-action", "Zoom 1:16"),
625,
625, FALSE,
PIKA_HELP_VIEW_ZOOM_OUT },
{ "view-zoom-other", NULL,
NC_("view-zoom-action", "Othe_r zoom factor..."), NULL, { NULL },
NC_("view-zoom-action", "Set a custom zoom factor"),
0,
NC_("view-zoom-action", "Othe_r zoom factor..."),
{ NULL },
NC_("view-zoom-action", "Set a custom zoom factor"),
0, TRUE,
PIKA_HELP_VIEW_ZOOM_OTHER }
};
@ -652,8 +672,6 @@ static const PikaEnumActionEntry view_scroll_vertical_actions[] =
void
view_actions_setup (PikaActionGroup *group)
{
PikaAction *action;
pika_action_group_add_actions (group, "view-action",
view_actions,
G_N_ELEMENTS (view_actions));
@ -667,12 +685,10 @@ view_actions_setup (PikaActionGroup *group)
G_N_ELEMENTS (view_zoom_actions),
view_zoom_cmd_callback);
pika_action_group_add_radio_actions (group, "view-zoom-action",
view_zoom_explicit_actions,
G_N_ELEMENTS (view_zoom_explicit_actions),
NULL,
10000,
view_zoom_explicit_cmd_callback);
pika_action_group_add_enum_actions (group, "view-zoom-action",
view_zoom_explicit_actions,
G_N_ELEMENTS (view_zoom_explicit_actions),
view_zoom_explicit_cmd_callback);
pika_action_group_add_toggle_actions (group, "view-action",
view_flip_actions,
@ -714,15 +730,6 @@ view_actions_setup (PikaActionGroup *group)
G_N_ELEMENTS (view_scroll_vertical_actions),
view_scroll_vertical_cmd_callback);
/* connect "activate" of view-zoom-other manually so it can be
* selected even if it's the active item of the radio group
*/
action = pika_action_group_get_action (group, "view-zoom-other");
g_signal_connect (action, "activate",
G_CALLBACK (view_zoom_other_cmd_callback),
group->user_data);
g_signal_connect_object (group->pika->config, "notify::check-type",
G_CALLBACK (view_actions_check_type_notify),
group, 0);
@ -987,55 +994,20 @@ static void
view_actions_set_zoom (PikaActionGroup *group,
PikaDisplayShell *shell)
{
const gchar *action = NULL;
PikaImageWindow *window;
PikaMenuModel *model;
gchar *str;
gchar *label;
guint scale;
g_object_get (shell->zoom,
"percentage", &str,
NULL);
scale = ROUND (pika_zoom_model_get_factor (shell->zoom) * 1000);
switch (scale)
{
case 16000: action = "view-zoom-16-1"; break;
case 8000: action = "view-zoom-8-1"; break;
case 4000: action = "view-zoom-4-1"; break;
case 2000: action = "view-zoom-2-1"; break;
case 1000: action = "view-zoom-1-1"; break;
case 500: action = "view-zoom-1-2"; break;
case 250: action = "view-zoom-1-4"; break;
case 125: action = "view-zoom-1-8"; break;
case 63:
case 62: action = "view-zoom-1-16"; break;
}
if (! action)
{
action = "view-zoom-other";
label = g_strdup_printf (_("Othe_r (%s)..."), str);
pika_action_group_set_action_label (group, action, label);
g_free (label);
shell->other_scale = pika_zoom_model_get_factor (shell->zoom);
}
pika_action_group_set_action_active (group, action, TRUE);
window = pika_display_shell_get_window (shell);
model = pika_image_window_get_menubar_model (window);
label = g_strdup_printf (_("_Zoom (%s)"), str);
pika_menu_model_set_title (model, "/View/Zoom", label);
g_free (label);
/* flag as dirty */
shell->other_scale = - fabs (shell->other_scale);
g_free (str);
}

View File

@ -288,22 +288,7 @@ view_zoom_explicit_cmd_callback (PikaAction *action,
(gdouble) factor / 10000,
PIKA_ZOOM_FOCUS_RETAIN_CENTERING_ELSE_BEST_GUESS);
}
}
/* not a PikaActionCallback */
void
view_zoom_other_cmd_callback (PikaAction *action,
gpointer data)
{
PikaDisplayShell *shell;
return_if_no_shell (shell, data);
/* check if we are activated by the user or from
* view_actions_set_zoom(), also this is really a GtkToggleAction
* NOT a PikaToggleAction
*/
if (pika_toggle_action_get_active (PIKA_TOGGLE_ACTION (action)) &&
shell->other_scale != pika_zoom_model_get_factor (shell->zoom))
else
{
pika_display_shell_scale_dialog (shell);
}

View File

@ -53,10 +53,6 @@ void view_zoom_explicit_cmd_callback (PikaAction *action,
GVariant *value,
gpointer data);
/* not a PikaActionCallback */
void view_zoom_other_cmd_callback (PikaAction *action,
gpointer data);
void view_show_all_cmd_callback (PikaAction *action,
GVariant *value,
gpointer data);

View File

@ -80,6 +80,7 @@ enum
PROP_ICON_THEME_PATH,
PROP_ICON_THEME,
PROP_PREFER_SYMBOLIC_ICONS,
PROP_FONT_RELATIVE_SIZE,
PROP_USE_HELP,
PROP_SHOW_HELP_BUTTON,
PROP_HELP_LOCALES,
@ -362,6 +363,13 @@ pika_gui_config_class_init (PikaGuiConfigClass *klass)
TRUE,
PIKA_PARAM_STATIC_STRINGS);
PIKA_CONFIG_PROP_DOUBLE (object_class, PROP_FONT_RELATIVE_SIZE,
"font-relative-size",
"Tweak font-size from the theme",
FONT_SIZE_BLURB,
0.5, 2.0, 1.0,
PIKA_PARAM_STATIC_STRINGS);
PIKA_CONFIG_PROP_BOOLEAN (object_class, PROP_USE_HELP,
"use-help",
"Use help",
@ -699,6 +707,9 @@ pika_gui_config_set_property (GObject *object,
case PROP_PREFER_SYMBOLIC_ICONS:
gui_config->prefer_symbolic_icons = g_value_get_boolean (value);
break;
case PROP_FONT_RELATIVE_SIZE:
gui_config->font_relative_size = g_value_get_double (value);
break;
case PROP_USE_HELP:
gui_config->use_help = g_value_get_boolean (value);
break;
@ -876,6 +887,9 @@ pika_gui_config_get_property (GObject *object,
case PROP_PREFER_SYMBOLIC_ICONS:
g_value_set_boolean (value, gui_config->prefer_symbolic_icons);
break;
case PROP_FONT_RELATIVE_SIZE:
g_value_set_double (value, gui_config->font_relative_size);
break;
case PROP_USE_HELP:
g_value_set_boolean (value, gui_config->use_help);
break;

View File

@ -72,6 +72,7 @@ struct _PikaGuiConfig
gchar *icon_theme_path;
gchar *icon_theme;
gboolean prefer_symbolic_icons;
gdouble font_relative_size;
gboolean override_icon_size;
PikaIconSize custom_icon_size;
gboolean use_help;

View File

@ -561,6 +561,9 @@ _("When enabled, symbolic icons will be preferred if available.")
#define ICON_THEME_PATH_BLURB \
"Sets the icon theme search path."
#define FONT_SIZE_BLURB \
_("Tweak font size of the graphical interface.")
#define IMAGE_CONVERT_PROFILE_INTENT_BLURB \
_("Sets the default rendering intent for the 'Convert to Color Profile' dialog.")

View File

@ -734,7 +734,7 @@ pika_file_is_executable (GFile *file)
if (info)
{
GFileType file_type = g_file_info_get_file_type (info);
GFileType file_type = g_file_info_get_attribute_uint32 (info, G_FILE_ATTRIBUTE_STANDARD_TYPE);
const gchar *filename = g_file_info_get_name (info);
if (file_type == G_FILE_TYPE_REGULAR &&

View File

@ -386,13 +386,13 @@ pika_data_loader_factory_load_directory (PikaDataFactory *factory,
GFileType file_type;
GFile *child;
if (g_file_info_get_is_hidden (info))
if (g_file_info_get_attribute_boolean (info, G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN))
{
g_object_unref (info);
continue;
}
file_type = g_file_info_get_file_type (info);
file_type = g_file_info_get_attribute_uint32 (info, G_FILE_ATTRIBUTE_STANDARD_TYPE);
child = g_file_enumerator_get_child (enumerator, info);
if (file_type == G_FILE_TYPE_DIRECTORY)

View File

@ -1022,7 +1022,7 @@ pika_extension_manager_search_directory (PikaExtensionManager *manager,
{
GFile *subdir;
if (g_file_info_get_is_hidden (info))
if (g_file_info_get_attribute_boolean (info, G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN))
{
g_object_unref (info);
continue;

View File

@ -456,7 +456,7 @@ pika_imagefile_create_thumbnail (PikaImagefile *imagefile,
G_FILE_QUERY_INFO_NONE,
NULL, NULL);
regular = (g_file_info_get_file_type (file_info) == G_FILE_TYPE_REGULAR);
regular = (g_file_info_get_attribute_uint32 (file_info, G_FILE_ATTRIBUTE_STANDARD_TYPE) == G_FILE_TYPE_REGULAR);
readable = g_file_info_get_attribute_boolean (file_info,
G_FILE_ATTRIBUTE_ACCESS_CAN_READ);
@ -719,7 +719,7 @@ pika_imagefile_icon_callback (GObject *source_object,
if (file_info)
{
private->icon = g_object_ref (g_file_info_get_icon (file_info));
private->icon = g_object_ref (G_ICON (g_file_info_get_attribute_object (file_info, G_FILE_ATTRIBUTE_STANDARD_ICON)));
g_object_unref (file_info);
}

View File

@ -1736,7 +1736,7 @@ pika_palette_load_detect_format (GFile *file,
if (info)
{
goffset size = g_file_info_get_size (info);
goffset size = g_file_info_get_attribute_uint64 (info, G_FILE_ATTRIBUTE_STANDARD_SIZE);
if (size == 768)
format = PIKA_PALETTE_FILE_FORMAT_ACT;

View File

@ -2,7 +2,7 @@
* a rebranding of The GNU Image Manipulation Program (created with heckimp)
* A derived work which may be trivial. However, any changes may be (C)2023 by Aldercone Studio
*
* Original copyright, applying to most contents (license remains unchanged):
* Original copyright, applying to most contents (license remains unchanged):
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software: you can redistribute it and/or modify
@ -45,13 +45,6 @@
#include "pika-intl.h"
/* The first authors are the creators and maintainers, don't shuffle
* them
*/
#define START_INDEX (G_N_ELEMENTS (creators) - 1 /*NULL*/ + \
G_N_ELEMENTS (maintainers) - 1 /*NULL*/)
typedef struct
{
GtkWidget *dialog;
@ -62,9 +55,6 @@ typedef struct
GtkWidget *anim_area;
PangoLayout *layout;
gint n_authors;
gint shuffle[G_N_ELEMENTS (authors) - 1]; /* NULL terminated */
guint timer;
gint index;
@ -116,7 +106,6 @@ about_dialog_create (PikaCoreConfig *config)
gchar *copyright;
gchar *version;
dialog.n_authors = G_N_ELEMENTS (authors) - 1;
dialog.config = config;
pixbuf = about_dialog_load_logo ();
@ -145,9 +134,6 @@ about_dialog_create (PikaCoreConfig *config)
"logo", pixbuf,
"website", "https://heckin.technology/AlderconeStudio/PIKApp/",
"website-label", _("Visit the PIKA website"),
"authors", authors,
"artists", artists,
"documenters", documenters,
/* Translators: insert your names here,
separated by newline */
"translator-credits", _("translator-credits"),
@ -480,27 +466,6 @@ about_dialog_add_update (PikaAboutDialog *dialog,
static void
about_dialog_reshuffle (PikaAboutDialog *dialog)
{
GRand *gr = g_rand_new ();
gint i;
for (i = 0; i < dialog->n_authors; i++)
dialog->shuffle[i] = i;
for (i = START_INDEX; i < dialog->n_authors; i++)
{
gint j = g_rand_int_range (gr, START_INDEX, dialog->n_authors);
if (i != j)
{
gint t;
t = dialog->shuffle[j];
dialog->shuffle[j] = dialog->shuffle[i];
dialog->shuffle[i] = t;
}
}
g_rand_free (gr);
}
static gboolean
@ -677,17 +642,11 @@ about_dialog_timer (gpointer data)
return FALSE;
case 1:
text = insert_spacers (_("PIKA is brought to you by"));
dialog->state += 1;
text = insert_spacers (_("PIKA is brought to you by Aldercone Studio"));
break;
case 2:
if (! (dialog->index < dialog->n_authors))
dialog->index = 0;
text = insert_spacers (authors[dialog->shuffle[dialog->index]]);
dialog->index += 1;
break;
return FALSE;
default:
g_return_val_if_reached (TRUE);

View File

@ -159,6 +159,11 @@ static void prefs_gui_config_notify_icon_size (GObject *config,
GtkRange *range);
static void prefs_icon_size_value_changed (GtkRange *range,
PikaGuiConfig *config);
static void prefs_gui_config_notify_font_size (GObject *config,
GParamSpec *pspec,
GtkRange *range);
static void prefs_font_size_value_changed (GtkRange *range,
PikaGuiConfig *config);
/* private variables */
@ -975,6 +980,38 @@ prefs_gui_config_notify_icon_size (GObject *config,
config);
}
static void
prefs_font_size_value_changed (GtkRange *range,
PikaGuiConfig *config)
{
gdouble value = gtk_range_get_value (range);
g_signal_handlers_block_by_func (config,
G_CALLBACK (prefs_gui_config_notify_font_size),
range);
g_object_set (G_OBJECT (config),
"font-relative-size", value / 100.0,
NULL);
g_signal_handlers_unblock_by_func (config,
G_CALLBACK (prefs_gui_config_notify_font_size),
range);
}
static void
prefs_gui_config_notify_font_size (GObject *config,
GParamSpec *pspec,
GtkRange *range)
{
g_signal_handlers_block_by_func (range,
G_CALLBACK (prefs_font_size_value_changed),
config);
gtk_range_set_value (range,
PIKA_GUI_CONFIG (config)->font_relative_size * 100.0);
g_signal_handlers_unblock_by_func (range,
G_CALLBACK (prefs_font_size_value_changed),
config);
}
static void
prefs_format_string_select_callback (GtkListBox *listbox,
GtkListBoxRow *row,
@ -2116,6 +2153,31 @@ prefs_dialog_new (Pika *pika,
gtk_box_pack_start (GTK_BOX (vbox3), scale, FALSE, FALSE, 0);
gtk_widget_show (scale);
/* Font sizes. */
vbox3 = prefs_frame_new (_("Font Scaling"), GTK_CONTAINER (vbox2), FALSE);
pika_help_set_help_data (vbox3,
_("Font scaling will not work with themes using absolute sizes."),
NULL);
scale = gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL,
50, 200, 10);
gtk_scale_set_value_pos (GTK_SCALE (scale), GTK_POS_BOTTOM);
gtk_scale_add_mark (GTK_SCALE (scale), 50.0, GTK_POS_BOTTOM,
_("50%"));
gtk_scale_add_mark (GTK_SCALE (scale), 100.0, GTK_POS_BOTTOM,
_("100%"));
gtk_scale_add_mark (GTK_SCALE (scale), 200.0, GTK_POS_BOTTOM,
_("200%"));
gtk_range_set_value (GTK_RANGE (scale),
(gdouble) PIKA_GUI_CONFIG (object)->font_relative_size * 100.0);
g_signal_connect (G_OBJECT (scale), "value-changed",
G_CALLBACK (prefs_font_size_value_changed),
PIKA_GUI_CONFIG (object));
g_signal_connect (G_OBJECT (object), "notify::font-relative-size",
G_CALLBACK (prefs_gui_config_notify_font_size),
scale);
gtk_box_pack_start (GTK_BOX (vbox3), scale, FALSE, FALSE, 0);
gtk_widget_show (scale);
/* Reload Current Theme button */
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0);

View File

@ -32,6 +32,7 @@
#include "core/pika.h"
#include "core/pikaviewable.h"
#include "widgets/pikaaction.h"
#include "widgets/pikahelp-ids.h"
#include "widgets/pikaviewabledialog.h"
@ -54,6 +55,9 @@ typedef struct
GtkAdjustment *scale_adj;
GtkAdjustment *num_adj;
GtkAdjustment *denom_adj;
gdouble prev_scale;
gdouble *other_scale;
} ScaleDialogData;
@ -81,6 +85,8 @@ static void update_zoom_values (GtkAdjustment *adj,
void
pika_display_shell_scale_dialog (PikaDisplayShell *shell)
{
/* scale factor entered in Zoom->Other*/
static gdouble other_scale = 0.0;
ScaleDialogData *data;
PikaImage *image;
GtkWidget *toplevel;
@ -98,19 +104,21 @@ pika_display_shell_scale_dialog (PikaDisplayShell *shell)
return;
}
if (SCALE_EQUALS (shell->other_scale, 0.0))
data = g_slice_new (ScaleDialogData);
data->prev_scale = other_scale;
data->other_scale = &other_scale;
if (SCALE_EQUALS (other_scale, 0.0))
{
/* other_scale not yet initialized */
shell->other_scale = pika_zoom_model_get_factor (shell->zoom);
other_scale = pika_zoom_model_get_factor (shell->zoom);
}
image = pika_display_get_image (shell->display);
data = g_slice_new (ScaleDialogData);
data->shell = shell;
data->model = g_object_new (PIKA_TYPE_ZOOM_MODEL,
"value", fabs (shell->other_scale),
"value", fabs (other_scale),
NULL);
g_set_weak_pointer
@ -189,7 +197,7 @@ pika_display_shell_scale_dialog (PikaDisplayShell *shell)
_("Zoom:"), 0.0, 0.5,
hbox, 1);
data->scale_adj = gtk_adjustment_new (fabs (shell->other_scale) * 100,
data->scale_adj = gtk_adjustment_new (other_scale * 100,
100.0 / 256.0, 25600.0,
10, 50, 0);
spin = pika_spin_button_new (data->scale_adj, 1.0, 2);
@ -219,7 +227,10 @@ pika_display_shell_scale_dialog_response (GtkWidget *widget,
{
if (response_id == GTK_RESPONSE_OK)
{
gdouble scale;
GAction *action;
gchar *label;
gchar *zoom_str;
gdouble scale;
scale = gtk_adjustment_get_value (dialog->scale_adj);
@ -227,14 +238,32 @@ pika_display_shell_scale_dialog_response (GtkWidget *widget,
PIKA_ZOOM_TO,
scale / 100.0,
PIKA_ZOOM_FOCUS_BEST_GUESS);
g_object_get (dialog->shell->zoom,
"percentage", &zoom_str,
NULL);
/* Change the "view-zoom-other" label. */
action = g_action_map_lookup_action (G_ACTION_MAP (dialog->shell->display->pika->app),
"view-zoom-other");
label = g_strdup_printf (_("Othe_r (%s)..."), zoom_str);
pika_action_set_short_label (PIKA_ACTION (action), label);
g_free (label);
label = g_strdup_printf (_("Custom Zoom (%s)..."), zoom_str);
pika_action_set_label (PIKA_ACTION (action), label);
g_free (label);
g_free (zoom_str);
}
else
{
/* need to emit "scaled" to get the menu updated */
pika_display_shell_scaled (dialog->shell);
}
dialog->shell->other_scale = - fabs (dialog->shell->other_scale);
*(dialog->other_scale) = dialog->prev_scale;
}
gtk_widget_destroy (dialog->shell->scale_dialog);
}
@ -271,6 +300,8 @@ update_zoom_values (GtkAdjustment *adj,
gtk_adjustment_set_value (dialog->num_adj, num);
gtk_adjustment_set_value (dialog->denom_adj, denom);
*(dialog->other_scale) = scale / 100.0;
}
else /* fraction adjustments */
{
@ -278,6 +309,8 @@ update_zoom_values (GtkAdjustment *adj,
gtk_adjustment_get_value (dialog->denom_adj));
gtk_adjustment_set_value (dialog->scale_adj, scale * 100);
*(dialog->other_scale) = scale;
}
g_signal_handlers_unblock_by_func (dialog->scale_adj,

View File

@ -87,8 +87,6 @@ struct _PikaDisplayShell
gint last_offset_x; /* offsets used when reverting zoom */
gint last_offset_y;
gdouble other_scale; /* scale factor entered in Zoom->Other*/
gint disp_width; /* width of drawing area */
gint disp_height; /* height of drawing area */

View File

@ -4210,11 +4210,12 @@ void
pika_tool_rectangle_frame_item (PikaToolRectangle *rectangle,
PikaItem *item)
{
PikaDisplayShell *shell;
gint offset_x;
gint offset_y;
gint width;
gint height;
PikaDisplayShell *shell;
gint offset_x;
gint offset_y;
gint width;
gint height;
PikaRectangleFunction old_function;
g_return_if_fail (PIKA_IS_TOOL_RECTANGLE (rectangle));
g_return_if_fail (PIKA_IS_ITEM (item));
@ -4230,6 +4231,7 @@ pika_tool_rectangle_frame_item (PikaToolRectangle *rectangle,
pika_item_get_offset (item, &offset_x, &offset_y);
old_function = rectangle->private->function;
pika_tool_rectangle_set_function (rectangle, PIKA_TOOL_RECTANGLE_CREATING);
g_object_set (rectangle,
@ -4243,6 +4245,7 @@ pika_tool_rectangle_frame_item (PikaToolRectangle *rectangle,
* if this function is ever moved out of the text tool code.
*/
pika_tool_rectangle_set_constraint (rectangle, PIKA_RECTANGLE_CONSTRAIN_NONE);
pika_tool_rectangle_set_function (rectangle, old_function);
}
void

View File

@ -134,7 +134,7 @@ file_open_image (Pika *pika,
if (! info)
return NULL;
if (g_file_info_get_file_type (info) != G_FILE_TYPE_REGULAR)
if (g_file_info_get_attribute_uint32 (info, G_FILE_ATTRIBUTE_STANDARD_TYPE) != G_FILE_TYPE_REGULAR)
{
g_set_error_literal (error, G_FILE_ERROR, G_FILE_ERROR_FAILED,
_("Not a regular file"));

View File

@ -138,7 +138,7 @@ file_save (Pika *pika,
goto out;
}
if (g_file_info_get_file_type (info) != G_FILE_TYPE_REGULAR)
if (g_file_info_get_attribute_uint32 (info, G_FILE_ATTRIBUTE_STANDARD_TYPE) != G_FILE_TYPE_REGULAR)
{
g_set_error_literal (error, G_FILE_ERROR, G_FILE_ERROR_FAILED,
_("Not a regular file"));

View File

@ -100,8 +100,8 @@ icon_themes_init (Pika *pika)
while ((info = g_file_enumerator_next_file (enumerator,
NULL, NULL)))
{
if (! g_file_info_get_is_hidden (info) &&
g_file_info_get_file_type (info) == G_FILE_TYPE_DIRECTORY)
if (! g_file_info_get_attribute_boolean (info, G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN) &&
g_file_info_get_attribute_uint32 (info, G_FILE_ATTRIBUTE_STANDARD_TYPE) == G_FILE_TYPE_DIRECTORY)
{
GFile *file;
GFile *index_theme;

View File

@ -599,7 +599,7 @@ splash_image_load_from_file (GFile *file,
{
const gchar *content_type;
content_type = g_file_info_get_content_type (info);
content_type = g_file_info_get_attribute_string (info, G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE);
if (content_type)
{
gchar *mime_type;

View File

@ -104,6 +104,9 @@ themes_init (Pika *pika)
g_signal_connect (config, "notify::custom-icon-size",
G_CALLBACK (themes_theme_change_notify),
pika);
g_signal_connect (config, "notify::font-relative-size",
G_CALLBACK (themes_theme_change_notify),
pika);
themes_theme_change_notify (config, NULL, pika);
}
@ -377,6 +380,12 @@ themes_apply_theme (Pika *pika,
button_icon_size);
}
if (! error && config->font_relative_size != 1.0)
g_output_stream_printf (output, NULL, NULL, &error,
"\n"
"* { font-size: %frem; }",
config->font_relative_size);
if (! error)
{
g_output_stream_printf (
@ -515,8 +524,8 @@ themes_theme_paths_notify (PikaExtensionManager *manager,
while ((info = g_file_enumerator_next_file (enumerator,
NULL, NULL)))
{
if (! g_file_info_get_is_hidden (info) &&
g_file_info_get_file_type (info) == G_FILE_TYPE_DIRECTORY)
if (! g_file_info_get_attribute_boolean (info, G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN) &&
g_file_info_get_attribute_uint32 (info, G_FILE_ATTRIBUTE_STANDARD_TYPE) == G_FILE_TYPE_DIRECTORY)
{
GFile *file;
const gchar *name;

View File

@ -273,9 +273,20 @@ shortcuts_action_deserialize (GScanner *scanner,
builder = g_strv_builder_new ();
while (pika_scanner_parse_string (scanner, &accel))
{
gchar **dup_actions;
gboolean add_accel = TRUE;
gchar **dup_actions;
gboolean add_accel = TRUE;
guint accelerator_key = 0;
GdkModifierType accelerator_mods = 0;
gtk_accelerator_parse (accel, &accelerator_key, &accelerator_mods);
if (accelerator_key == 0 && accelerator_mods == 0)
{
g_printerr ("INFO: invalid accelerator '%s' on '%s'.\n"
" Removing this accelerator.\n",
accel, action_name);
g_free (accel);
continue;
}
dup_actions = gtk_application_get_actions_for_accel (application, accel);
for (gint i = 0; dup_actions[i] != NULL; i++)

View File

@ -5042,7 +5042,7 @@ register_image_procs (PikaPDB *pdb)
"pika-image-get-imported-file");
pika_procedure_set_static_help (procedure,
"Returns the imported file for the specified image.",
"This procedure returns the file associated with the specified image if the image was imported from a non-native Pika format. If the image was not imported, or has since been saved in the native Pika format, this procedure returns %NULL.",
"This procedure returns the file associated with the specified image if the image was imported from a non-native Pika format. If the image was not imported, or has since been saved in the native Gimp format, this procedure returns %NULL.",
NULL);
pika_procedure_set_static_attribution (procedure,
"Eric Grivel <pika@lumenssolutions.com>",

View File

@ -174,8 +174,8 @@ pika_environ_table_load (PikaEnvironTable *environ_table,
while ((info = g_file_enumerator_next_file (enumerator,
NULL, NULL)))
{
if (! g_file_info_get_is_hidden (info) &&
g_file_info_get_file_type (info) == G_FILE_TYPE_REGULAR)
if (! g_file_info_get_attribute_boolean (info, G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN) &&
g_file_info_get_attribute_uint32 (info, G_FILE_ATTRIBUTE_STANDARD_TYPE) == G_FILE_TYPE_REGULAR)
{
GFile *file = g_file_enumerator_get_child (enumerator, info);

View File

@ -167,8 +167,8 @@ pika_interpreter_db_load (PikaInterpreterDB *db,
while ((info = g_file_enumerator_next_file (enumerator,
NULL, NULL)))
{
if (! g_file_info_get_is_hidden (info) &&
g_file_info_get_file_type (info) == G_FILE_TYPE_REGULAR)
if (! g_file_info_get_attribute_boolean (info, G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN) &&
g_file_info_get_attribute_uint32 (info, G_FILE_ATTRIBUTE_STANDARD_TYPE) == G_FILE_TYPE_REGULAR)
{
GFile *file = g_file_enumerator_get_child (enumerator, info);

View File

@ -687,7 +687,7 @@ file_check_single_magic (const gchar *offset,
if (! info)
return FILE_MATCH_NONE;
fileval = g_file_info_get_size (info);
fileval = g_file_info_get_attribute_uint64 (info, G_FILE_ATTRIBUTE_STANDARD_SIZE);
g_object_unref (info);
}
else if (offs >= 0 &&

View File

@ -273,7 +273,7 @@ pika_plug_in_manager_search_directory (PikaPlugInManager *manager,
{
GFile *child;
if (g_file_info_get_is_hidden (info))
if (g_file_info_get_attribute_boolean (info, G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN))
{
g_object_unref (info);
continue;
@ -309,7 +309,7 @@ pika_plug_in_manager_search_directory (PikaPlugInManager *manager,
gchar *file_name;
char *ext;
if (g_file_info_get_is_hidden (info2))
if (g_file_info_get_attribute_boolean (info2, G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN))
{
g_object_unref (info2);
continue;

View File

@ -63,6 +63,20 @@
#define DEBUGPRINT(x) /* g_print x */
enum
{
PIKA_FONT_SYMBOL_FONTHASH,
PIKA_FONT_SYMBOL_FULLNAME,
PIKA_FONT_SYMBOL_FAMILY,
PIKA_FONT_SYMBOL_STYLE,
PIKA_FONT_SYMBOL_PSNAME,
PIKA_FONT_SYMBOL_INDEX,
PIKA_FONT_SYMBOL_WEIGHT,
PIKA_FONT_SYMBOL_SLANT,
PIKA_FONT_SYMBOL_WIDTH,
PIKA_FONT_SYMBOL_FONTVERSION
};
enum
{
PROP_0,
@ -231,18 +245,21 @@ pika_font_deserialize_create (GType type,
gint most_similar_font_index = -1;
gint font_count = pika_container_get_n_children (fonts_container);
gint largest_similarity = 0;
gint similar_fonts = 0;
GList *similar_fonts = NULL;
GList *iter;
gint i;
gchar *fonthash;
gchar *fullname;
gchar *family;
gchar *psname;
gchar *style;
gint index;
gint weight;
gint slant;
gint width;
gint fontversion;
gchar *fonthash = NULL;
gchar *fullname = NULL;
gchar *family = NULL;
gchar *psname = NULL;
gchar *style = NULL;
gint index = -1;
gint weight = -1;
gint slant = -1;
gint width = -1;
gint fontversion = -1;
guint scope_id;
guint old_scope_id;
/* This is for backward compatibility with older xcf files.
* The font used to be serialized as a string containing
@ -250,7 +267,7 @@ pika_font_deserialize_create (GType type,
*/
if (g_scanner_peek_next_token (scanner) == G_TOKEN_STRING)
{
gchar* font_name;
gchar* font_name = NULL;
pika_scanner_parse_string (scanner, &font_name);
@ -269,61 +286,119 @@ pika_font_deserialize_create (GType type,
else
g_object_ref (font);
g_free (font_name);
return PIKA_CONFIG (PIKA_FONT (font));
}
if (g_scanner_peek_next_token (scanner) == G_TOKEN_RIGHT_PAREN)
return PIKA_CONFIG (PIKA_FONT (pika_font_get_standard ()));
g_scanner_get_next_token (scanner); /* ( */
g_scanner_get_next_token (scanner); /* "fonthash" */
pika_scanner_parse_string (scanner, &fonthash);
g_scanner_get_next_token (scanner); /* ) */
scope_id = g_type_qname (type);
old_scope_id = g_scanner_set_scope (scanner, scope_id);
g_scanner_get_next_token (scanner); /* ( */
g_scanner_get_next_token (scanner); /* "fullname" */
pika_scanner_parse_string (scanner, &fullname);
g_scanner_get_next_token (scanner); /* ) */
g_scanner_scope_add_symbol (scanner, scope_id, "fonthash",
GINT_TO_POINTER (PIKA_FONT_SYMBOL_FONTHASH));
g_scanner_scope_add_symbol (scanner, scope_id, "fullname",
GINT_TO_POINTER (PIKA_FONT_SYMBOL_FULLNAME));
g_scanner_scope_add_symbol (scanner, scope_id, "family",
GINT_TO_POINTER (PIKA_FONT_SYMBOL_FAMILY));
g_scanner_scope_add_symbol (scanner, scope_id, "style",
GINT_TO_POINTER (PIKA_FONT_SYMBOL_STYLE));
g_scanner_scope_add_symbol (scanner, scope_id, "psname",
GINT_TO_POINTER (PIKA_FONT_SYMBOL_PSNAME));
g_scanner_scope_add_symbol (scanner, scope_id, "index",
GINT_TO_POINTER (PIKA_FONT_SYMBOL_INDEX));
g_scanner_scope_add_symbol (scanner, scope_id, "weight",
GINT_TO_POINTER (PIKA_FONT_SYMBOL_WEIGHT));
g_scanner_scope_add_symbol (scanner, scope_id, "slant",
GINT_TO_POINTER (PIKA_FONT_SYMBOL_SLANT));
g_scanner_scope_add_symbol (scanner, scope_id, "width",
GINT_TO_POINTER (PIKA_FONT_SYMBOL_WIDTH));
g_scanner_scope_add_symbol (scanner, scope_id, "fontversion",
GINT_TO_POINTER (PIKA_FONT_SYMBOL_FONTVERSION));
g_scanner_get_next_token (scanner); /* ( */
g_scanner_get_next_token (scanner); /* "family" */
pika_scanner_parse_string (scanner, &family);
g_scanner_get_next_token (scanner); /* ) */
while (g_scanner_peek_next_token (scanner) == G_TOKEN_LEFT_PAREN)
{
GTokenType token;
g_scanner_get_next_token (scanner); /* ( */
g_scanner_get_next_token (scanner); /* "style" */
pika_scanner_parse_string (scanner, &style);
g_scanner_get_next_token (scanner); /* ) */
g_scanner_get_next_token (scanner); /* ( */
g_scanner_get_next_token (scanner); /* ( */
g_scanner_get_next_token (scanner); /* "psname" */
pika_scanner_parse_string (scanner, &psname);
g_scanner_get_next_token (scanner); /* ( */
token = g_scanner_get_next_token (scanner);
g_scanner_get_next_token (scanner); /* ( */
g_scanner_get_next_token (scanner); /* "font index" */
pika_scanner_parse_int (scanner, &index);
g_scanner_get_next_token (scanner); /* ) */
if (token != G_TOKEN_SYMBOL)
{
/* When encountering an unknown symbol, we simply ignore its contents
* (up to the next closing parenthese). This would allow us to load
* future XCF files in case we add new fields to recognize fonts
* without having to bump the XCF version (just ignoring unknown
* fields). We still output a small message on stderr.
*/
if (token == G_TOKEN_IDENTIFIER)
g_printerr ("%s: ignoring unknown symbol '%s'.\n", G_STRFUNC, scanner->value.v_string);
else
g_printerr ("%s: ignoring unknown token %d.\n", G_STRFUNC, token);
g_scanner_get_next_token (scanner); /* ( */
g_scanner_get_next_token (scanner); /* "weight" */
pika_scanner_parse_int (scanner, &weight);
g_scanner_get_next_token (scanner); /* ) */
while ((token = g_scanner_get_next_token (scanner)) != G_TOKEN_EOF)
{
if (token == G_TOKEN_RIGHT_PAREN)
break;
}
g_scanner_get_next_token (scanner); /* ( */
g_scanner_get_next_token (scanner); /* "slant" */
pika_scanner_parse_int (scanner, &slant);
g_scanner_get_next_token (scanner); /* ) */
continue;
}
g_scanner_get_next_token (scanner); /* ( */
g_scanner_get_next_token (scanner); /* "width" */
pika_scanner_parse_int (scanner, &width);
g_scanner_get_next_token (scanner); /* ) */
switch (GPOINTER_TO_INT (scanner->value.v_symbol))
{
case PIKA_FONT_SYMBOL_FONTHASH:
pika_scanner_parse_string (scanner, &fonthash);
break;
case PIKA_FONT_SYMBOL_FULLNAME:
pika_scanner_parse_string (scanner, &fullname);
break;
case PIKA_FONT_SYMBOL_FAMILY:
pika_scanner_parse_string (scanner, &family);
break;
case PIKA_FONT_SYMBOL_STYLE:
pika_scanner_parse_string (scanner, &style);
break;
case PIKA_FONT_SYMBOL_PSNAME:
pika_scanner_parse_string (scanner, &psname);
break;
case PIKA_FONT_SYMBOL_INDEX:
pika_scanner_parse_int (scanner, &index);
break;
case PIKA_FONT_SYMBOL_WEIGHT:
pika_scanner_parse_int (scanner, &weight);
break;
case PIKA_FONT_SYMBOL_SLANT:
pika_scanner_parse_int (scanner, &slant);
break;
case PIKA_FONT_SYMBOL_WIDTH:
pika_scanner_parse_int (scanner, &width);
break;
case PIKA_FONT_SYMBOL_FONTVERSION:
pika_scanner_parse_int (scanner, &fontversion);
break;
default:
break;
}
g_scanner_get_next_token (scanner); /* ( */
g_scanner_get_next_token (scanner); /* "fontversion" */
pika_scanner_parse_int (scanner, &fontversion);
g_scanner_get_next_token (scanner); /* ) */
if (g_scanner_get_next_token (scanner) != G_TOKEN_RIGHT_PAREN)
break;
}
g_scanner_scope_remove_symbol (scanner, scope_id, "fonthash");
g_scanner_scope_remove_symbol (scanner, scope_id, "fullname");
g_scanner_scope_remove_symbol (scanner, scope_id, "family");
g_scanner_scope_remove_symbol (scanner, scope_id, "style");
g_scanner_scope_remove_symbol (scanner, scope_id, "psname");
g_scanner_scope_remove_symbol (scanner, scope_id, "index");
g_scanner_scope_remove_symbol (scanner, scope_id, "weight");
g_scanner_scope_remove_symbol (scanner, scope_id, "slant");
g_scanner_scope_remove_symbol (scanner, scope_id, "width");
g_scanner_scope_remove_symbol (scanner, scope_id, "fontversion");
g_scanner_set_scope (scanner, old_scope_id);
for (i = 0; i < font_count; i++)
{
@ -331,10 +406,10 @@ pika_font_deserialize_create (GType type,
font = PIKA_FONT (pika_container_get_child_by_index (fonts_container, i));
if (font->hash != NULL && !g_strcmp0 (font->hash, fonthash))
if (fonthash != NULL && font->hash != NULL && !g_strcmp0 (font->hash, fonthash))
{
most_similar_font_index = i;
similar_fonts = 1;
g_clear_pointer (&similar_fonts, g_list_free);
break;
}
@ -342,19 +417,19 @@ pika_font_deserialize_create (GType type,
* hence their higher importance in measuring similarity.
*/
if (!g_strcmp0 (font->fullname, fullname))
if (fullname != NULL && !g_strcmp0 (font->fullname, fullname))
current_font_similarity += 5;
if (!g_strcmp0 (font->family, family))
if (family != NULL && !g_strcmp0 (font->family, family))
current_font_similarity += 5;
if (font->psname != NULL && !g_strcmp0 (font->psname, psname))
if (psname != NULL && font->psname != NULL && !g_strcmp0 (font->psname, psname))
current_font_similarity += 5;
if (current_font_similarity < 5)
continue;
if (font->style != NULL && !g_strcmp0 (font->style, style))
if (style != NULL && font->style != NULL && !g_strcmp0 (font->style, style))
current_font_similarity++;
if (font->weight != -1 && font->weight == weight)