Commit c83cf0ec authored by Zander's avatar Zander 💥

Move most icons in lib

GResource instead of inline pixbuf
parent 892bb8a6
......@@ -75,7 +75,7 @@
#include "dia-app-icons.h"
static gboolean
handle_initial_diagram(const char *input_file_name,
handle_initial_diagram(const char *input_file_name,
const char *export_file_name,
const char *export_file_format,
const char *size,
......@@ -278,7 +278,7 @@ const char *argv0 = NULL;
* size might be NULL.
*/
static gboolean
do_convert(const char *infname,
do_convert(const char *infname,
const char *outfname, DiaExportFilter *ef,
const char *size,
char *show_layers)
......@@ -288,7 +288,7 @@ do_convert(const char *infname,
DiaContext *ctx;
inf = filter_guess_import_filter(infname);
if (!inf)
if (!inf)
inf = &dia_import_filter;
if (ef == NULL) {
......@@ -307,7 +307,7 @@ do_convert(const char *infname,
argv0, infname);
exit(1);
}
diagdata = g_object_new (DIA_TYPE_DIAGRAM_DATA, NULL);
ctx = dia_context_new(_("Import"));
......@@ -324,15 +324,15 @@ do_convert(const char *infname,
/* recalculate before export */
data_update_extents(diagdata);
/* Do our best in providing the size to the filter, but don't abuse user_data
* too much for it. It _must not_ be changed after initialization and there
/* Do our best in providing the size to the filter, but don't abuse user_data
* too much for it. It _must not_ be changed after initialization and there
* are quite some filter selecting their output format by it. --hb
*/
if (size) {
if (ef == filter_export_get_by_name ("png-libart")) /* the warning we get is appropriate, don't cast */
ef->export_func(diagdata, ctx, outfname, infname, (gpointer) size);
else {
g_warning ("--size parameter unsupported for %s filter",
g_warning ("--size parameter unsupported for %s filter",
ef->unique_name ? ef->unique_name : "selected");
ef->export_func(diagdata, ctx, outfname, infname, ef->user_data);
}
......@@ -352,7 +352,7 @@ int debug_break_dont_optimize = 1;
void
debug_break(void)
{
if (debug_break_dont_optimize > 0)
if (debug_break_dont_optimize > 0)
debug_break_dont_optimize -= 1;
}
......@@ -382,9 +382,9 @@ dump_dependencies(void)
#endif
"\n");
/* print out all those dependies, both compile and runtime if possible
* Note: this is not meant to be complete but does only include libaries
* which may or have cause(d) us trouble in some versions
/* print out all those dependies, both compile and runtime if possible
* Note: this is not meant to be complete but does only include libaries
* which may or have cause(d) us trouble in some versions
*/
g_print ("Library versions (at compile time)\n");
#ifdef HAVE_LIBPNG
......@@ -425,13 +425,13 @@ dump_dependencies(void)
#endif
libxml_rt_version = xmlParserVersion;
if (atoi(libxml_rt_version))
g_print ("libxml : %d.%d.%d (%s)\n",
g_print ("libxml : %d.%d.%d (%s)\n",
atoi(libxml_rt_version) / 10000, atoi(libxml_rt_version) / 100 % 100, atoi(libxml_rt_version) % 100,
LIBXML_DOTTED_VERSION);
else /* may include "extra" */
g_print ("libxml : %s (%s)\n", libxml_rt_version ? libxml_rt_version : "??", LIBXML_DOTTED_VERSION);
}
g_print ("glib : %d.%d.%d (%d.%d.%d)\n",
g_print ("glib : %d.%d.%d (%d.%d.%d)\n",
glib_major_version, glib_minor_version, glib_micro_version,
GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION);
#ifdef PANGO_VERSION_ENCODE
......@@ -477,7 +477,7 @@ app_is_interactive(void)
* even more arguments, but create a more general system.
*/
static gboolean
handle_initial_diagram(const char *in_file_name,
handle_initial_diagram(const char *in_file_name,
const char *out_file_name,
const char *export_file_format,
const char *size,
......@@ -517,7 +517,7 @@ handle_initial_diagram(const char *in_file_name,
/* if this looks like an ugly hack to you, agreed ;) */
if (size && strstr(out_file_name, ".png"))
ef = filter_export_get_by_name ("png-libart");
made_conversions |= do_convert(in_file_name, out_file_name, ef,
size, show_layers);
} else {
......@@ -526,7 +526,7 @@ handle_initial_diagram(const char *in_file_name,
} else {
diagram = new_diagram (in_file_name);
}
if (diagram != NULL) {
diagram_update_extents(diagram);
if (app_is_interactive()) {
......@@ -609,7 +609,7 @@ _setup_textdomains (void)
#endif
#if defined ENABLE_NLS && defined HAVE_BIND_TEXTDOMAIN_CODESET
bind_textdomain_codeset(GETTEXT_PACKAGE,"UTF-8");
bind_textdomain_codeset(GETTEXT_PACKAGE,"UTF-8");
#endif
textdomain(GETTEXT_PACKAGE);
}
......@@ -670,7 +670,7 @@ app_init (int argc, char **argv)
NULL, NULL },
{ NULL }
};
/* for users of app_init() the default is interactive */
dia_is_interactive = TRUE;
......@@ -712,8 +712,8 @@ app_init (int argc, char **argv)
/* second level check of command line options, existance of input files etc. */
if (filenames) {
while (filenames[i] != NULL) {
gchar *filename;
gchar *testpath;
gchar *filename;
gchar *testpath;
if (g_str_has_prefix (filenames[i], "file://")) {
filename = g_filename_from_uri (filenames[i], NULL, NULL);
......@@ -762,6 +762,11 @@ app_init (int argc, char **argv)
g_set_application_name (_("Dia Diagram Editor"));
gtk_init(&argc, &argv);
/* GTK: (Defunct with GtkApplication)
* gtk_icon_theme_add_resource_path (gtk_icon_theme_get_default (),
* "/org/gnome/Dia/icons/");
*/
/* Set the icon for Dia windows & dialogs */
/* MESON: Use GResource */
/* GTK3: Use icon-name with GResource fallback */
......@@ -779,8 +784,8 @@ app_init (int argc, char **argv)
g_type_init();
#endif
/*
* On Windows there is no command line without display so that gtk_init is harmless.
* On X11 we need gtk_init_check() to avoid exit() just because there is no display
* On Windows there is no command line without display so that gtk_init is harmless.
* On X11 we need gtk_init_check() to avoid exit() just because there is no display
* running outside of X11.
*/
if (!gtk_init_check(&argc, &argv))
......@@ -861,7 +866,7 @@ app_init (int argc, char **argv)
if (dia_is_interactive) {
/* further initialization *before* reading files */
/* further initialization *before* reading files */
active_tool = create_modify_tool();
dia_log_message ("ui creation");
......@@ -880,7 +885,7 @@ app_init (int argc, char **argv)
g_timeout_add_seconds(5*60, autosave_check_autosave, NULL);
#if 0 /* do we really open these automatically in the next session? */
persistence_register_window_create("diagram_tree",
persistence_register_window_create("diagram_tree",
&diagram_tree_show);
#endif
persistence_register_window_create("sheets_main_dialog",
......@@ -899,7 +904,7 @@ app_init (int argc, char **argv)
if (use_integrated_ui) {
GList * list;
file_new_callback(NULL);
file_new_callback(NULL);
list = dia_open_diagrams();
if (list) {
Diagram * diagram = list->data;
......@@ -910,14 +915,14 @@ app_init (int argc, char **argv)
gchar *filename = g_filename_from_utf8(_("Diagram1.dia"), -1, NULL, NULL, NULL);
Diagram *diagram = new_diagram (filename);
g_free(filename);
if (diagram != NULL) {
diagram_update_extents(diagram);
diagram->is_default = TRUE;
/* I think this is done in diagram_init() with a call to
/* I think this is done in diagram_init() with a call to
* layer_dialog_update_diagram_list() */
layer_dialog_set_diagram(diagram);
new_display(diagram);
new_display(diagram);
}
}
}
......@@ -953,10 +958,10 @@ app_exit(void)
GtkWidget *dialog;
int result;
exit_dialog_item_array_t *items = NULL;
GList * list;
GList * list;
Diagram * diagram;
dialog = exit_dialog_make (GTK_WINDOW (interface_get_toolbox_shell ()),
dialog = exit_dialog_make (GTK_WINDOW (interface_get_toolbox_shell ()),
_("Exiting Dia"));
list = dia_open_diagrams();
......@@ -975,7 +980,7 @@ app_exit(void)
}
result = exit_dialog_run (dialog, &items);
gtk_widget_destroy (dialog);
if (result == EXIT_DIALOG_EXIT_CANCEL)
......@@ -1004,8 +1009,8 @@ app_exit(void)
}
dia_context_release (ctx);
exit_dialog_free_items (items);
}
else if (result == EXIT_DIALOG_EXIT_NO_SAVE)
}
else if (result == EXIT_DIALOG_EXIT_NO_SAVE)
{
list = dia_open_diagrams();
while (list) {
......@@ -1033,7 +1038,7 @@ app_exit(void)
"without saving them?"));
gtk_window_set_title (GTK_WINDOW(dialog), _("Quit Dia"));
button = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
gtk_dialog_add_action_widget (GTK_DIALOG(dialog), button, GTK_RESPONSE_CANCEL);
#if GTK_CHECK_VERSION(2,18,0)
......@@ -1082,7 +1087,7 @@ app_exit(void)
}
/* The diagram is freed when the last display is destroyed */
}
/* save pluginrc */
if (dia_is_interactive)
dia_pluginrc_write();
......@@ -1178,7 +1183,7 @@ handle_all_diagrams(GSList *files, char *export_file_name,
}
/* --credits option. Added by Andrew Ferrier.
Hopefully we're not ignoring anything too crucial by
quitting directly after the credits.
......
......@@ -46,7 +46,7 @@ struct _DiaImageClass {
* a downscaled variant of the underlying pixbuf. Also there is special handling
* of 'broken' i.e. typically empty images.
*
* _DiaImage can be used to assemble _DiaObjects - it is also part of the
* _DiaImage can be used to assemble _DiaObjects - it is also part of the
* _DiaRenderer interface and thus provides interface to all of the exporters.
*
* \ingroup ObjectParts
......@@ -87,7 +87,7 @@ dia_image_get_type (void)
object_type = g_type_register_static (G_TYPE_OBJECT,
"DiaImage",
&object_info, 0);
}
}
return object_type;
}
......@@ -105,7 +105,7 @@ dia_image_class_init(DiaImageClass* klass)
* \brief Constructor
* \memberof _DiaImage
*/
static void
static void
dia_image_init_instance(DiaImage *image)
{
/* GObject *gobject = G_OBJECT(image); */
......@@ -148,8 +148,10 @@ dia_image_get_broken(void)
image = DIA_IMAGE(g_object_new(DIA_TYPE_IMAGE, NULL));
if (broken == NULL) {
/* initial refernce will finally be leaked */
broken = gdk_pixbuf_new_from_inline(-1, dia_broken_icon, FALSE, NULL);
broken = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),
"image-missing",
64,
0, NULL);
}
image->image = g_object_ref (broken);
/* Kinda hard to export :) */
......@@ -221,7 +223,7 @@ dia_image_new_from_pixbuf (GdkPixbuf *pixbuf)
mime_type = g_object_get_data (G_OBJECT (pixbuf), "mime-type");
if (mime_type)
dia_img->mime_type = g_strdup (mime_type);
return dia_img;
}
......@@ -250,7 +252,7 @@ dia_image_unref(DiaImage *image)
* @param height Height in pixels of result.
* \memberof _DiaImage
*/
GdkPixbuf *
GdkPixbuf *
dia_image_get_scaled_pixbuf(DiaImage *image, int width, int height)
{
GdkPixbuf *scaled;
......@@ -273,7 +275,7 @@ dia_image_get_scaled_pixbuf(DiaImage *image, int width, int height)
}
scaled = image->scaled;
#else
scaled = gdk_pixbuf_scale_simple(image->image, width, height,
scaled = gdk_pixbuf_scale_simple(image->image, width, height,
GDK_INTERP_TILES);
#endif
} else {
......@@ -334,7 +336,7 @@ dia_image_save(DiaImage *image, const gchar *filename)
if (image->image) {
GError *error = NULL;
gchar *type = _guess_format (filename);
if (type) /* XXX: consider image->mime_type */
saved = gdk_pixbuf_save (image->image, filename, type, &error, NULL);
if (saved) {
......@@ -362,7 +364,7 @@ dia_image_save(DiaImage *image, const gchar *filename)
* @return The natural width of the object in pixels.
* \memberof _DiaImage
*/
int
int
dia_image_width(const DiaImage *image)
{
g_return_val_if_fail (image != NULL, 0);
......@@ -375,7 +377,7 @@ dia_image_width(const DiaImage *image)
* @return The natural height of the object in pixels.
* \memberof _DiaImage
*/
int
int
dia_image_height(const DiaImage *image)
{
g_return_val_if_fail (image != NULL, 0);
......@@ -400,7 +402,7 @@ dia_image_rowstride(const DiaImage *image)
* @return The pixbuf
* \memberof _DiaImage
*/
const GdkPixbuf*
const GdkPixbuf*
dia_image_pixbuf (const DiaImage *image)
{
if (!image)
......@@ -474,7 +476,7 @@ dia_image_rgb_data(const DiaImage *image)
}
}
/*!
/*!
* \brief Get the mask data for an image.
* @param image An image object.
* @return An array of bytes (width*height) with the alpha channel information
......@@ -491,7 +493,7 @@ dia_image_mask_data(const DiaImage *image)
if (!gdk_pixbuf_get_has_alpha(image->image)) {
return NULL;
}
pixels = gdk_pixbuf_get_pixels(image->image);
size = gdk_pixbuf_get_width(image->image)*
......@@ -521,7 +523,7 @@ dia_image_rgba_data(const DiaImage *image)
g_return_val_if_fail (image != NULL, 0);
if (gdk_pixbuf_get_has_alpha(image->image)) {
const guint8 *pixels = gdk_pixbuf_get_pixels(image->image);
return pixels;
} else {
return NULL;
......
# Generate csource for the icons.
icons = [ 'broken.png', 'broken-chain.png', 'unbroken-chain.png', 'standard-path.png' ]
icons = [ 'standard-path.png' ]
#TODO: this is duplicated in app/pixmaps, lib/pixmaps and objects/standard/pixmaps.
# Remove from all three once we port from gdk_pixbuf_csource to GResource.
......
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/org/gnome/Dia">
<file>icons/dia-chain-unbroken.png</file>
<file>icons/dia-chain-broken.png</file>
<file>icons/standard-path.png</file>
</gresource>
</gresources>
\ No newline at end of file
......@@ -106,7 +106,11 @@ diamarshal = gnome.genmarshal(
# TODO: This is used in app/, should we install / do anything else with it?
diamarshal_h = diamarshal[1]
subdir('pixmaps')
resources = gnome.compile_resources('libdia-resources', 'libdia.gresource.xml',
source_dir : '.',
c_name : 'libdia')
subdir('icons')
libdia_deps = [
libc_dep,
......@@ -121,7 +125,7 @@ libdia_deps = [
libdia_inc = include_directories('.')
libdia_lib = library('dia',
libdia_sources + [diamarshal, dia_lib_icons_h, config_h],
libdia_sources + [diamarshal, resources, config_h],
dependencies: libdia_deps,
include_directories: configuration_inc,
c_args: ['-Wall', '-DLIBDIA_COMPILATION'],
......@@ -131,4 +135,4 @@ libdia_lib = library('dia',
libdia_dep = declare_dependency (include_directories: libdia_inc,
link_with: libdia_lib,
dependencies: libdia_deps)
\ No newline at end of file
dependencies: libdia_deps)
/* XPM */
static char * broken_xpm[] = {
"64 64 21 1",
" c None",
". c #110609",
"+ c #9F8F92",
"@ c #950E24",
"# c #A54E5D",
"$ c #D0CAC9",
"% c #9C2D40",
"& c #594E4F",
"* c #9F6F77",
"= c #4C3237",
"- c #BAAFB1",
"; c #580F1B",
"> c #FEFBFA",
", c #F32D4E",
"' c #F66F85",
") c #F98FA1",
"! c #F01237",
"~ c #F54F6A",
"{ c #727172",
"] c #FAB1BE",
"^ c #FDD2D8",
"]^]^^>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>^^^))'~~~,~'",
"))]]^^^>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>^]])'~,,!,,~",
"''')]]^^>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>^^^]])'~~,!!!,~",
",~~')]^^^>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>^^^))~~,,!!!!!~",
"!,,~'']]^>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>^^^^]))'~,!!!!!!,~",
"!!,,~')]^^>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^^^>>>>>",
"!,,~'')]^^>>>>>>>>>>>>>>>>>>>>>>>^^^]])''~~,!!!!!!!,,~')]^>>>>>>",
",~~')]]^^>>>>>>>>>>>>>>>>>>>>>>>>>>^^^]))'~~,,!!!!!!!,~')]^^>>>>",
"''')]]^^>>>>>>>>>>>>>>>>>>>>>>>>>>>>^^^]])'~~,!!!!!!!!~')^^>>>>>",
"))]]^^^>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>^^^))~~,!!!!!!!,')]^^>>>>",
"]]^^^>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>^^^]))'~,,!!!!,~')^^>>>>>",
"^^^^>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>^>^]))'~~,,!,,~))^^^>>>>",
">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>^^^])''~~~~'')]^>>>>>>",
"^>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>^^^]]))''')]]^^^>>>>>",
">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>^^^^]]])]]]^^>>>>>>>",
">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>^^^^^]^^^^^>>>>>>>"};
......@@ -25,7 +25,6 @@
#include "dia_dirs.h"
#include "diadynamicmenu.h"
#include "diaoptionmenu.h"
#include "pixmaps/dia-lib-icons.h"
#include <stdlib.h>
#include <glib.h>
......@@ -40,7 +39,7 @@
/* A widget that selects two sizes, width and height, optionally keeping
* aspect ratio. When created, aspect ratio is locked, but the user can
* unlock it. The current users do not store aspect ratio, so we have
* to give a good default.
* to give a good default.
*/
struct _DiaSizeSelector
{
......@@ -78,7 +77,7 @@ dia_size_selector_class_init (DiaSizeSelectorClass *class)
static void
dia_size_selector_adjust_width(DiaSizeSelector *ss)
{
real height =
real height =
gtk_spin_button_get_value(GTK_SPIN_BUTTON(ss->height));
if (fabs(ss->ratio) > 1e-6)
gtk_spin_button_set_value(GTK_SPIN_BUTTON(ss->width), height*ss->ratio);
......@@ -87,24 +86,24 @@ dia_size_selector_adjust_width(DiaSizeSelector *ss)
static void
dia_size_selector_adjust_height(DiaSizeSelector *ss)
{
real width =
real width =
gtk_spin_button_get_value(GTK_SPIN_BUTTON(ss->width));
if (fabs(ss->ratio) > 1e-6)
gtk_spin_button_set_value(GTK_SPIN_BUTTON(ss->height), width/ss->ratio);
}
static void
dia_size_selector_ratio_callback(GtkAdjustment *limits, gpointer userdata)
dia_size_selector_ratio_callback(GtkAdjustment *limits, gpointer userdata)
{
static gboolean in_progress = FALSE;
DiaSizeSelector *ss = DIA_SIZE_SELECTOR(userdata);
ss->last_adjusted = limits;
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ss->aspect_locked))
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ss->aspect_locked))
&& ss->ratio != 0.0) {
if (in_progress)
if (in_progress)
return;
in_progress = TRUE;
......@@ -125,11 +124,11 @@ dia_size_selector_ratio_callback(GtkAdjustment *limits, gpointer userdata)
* If height is 0, ratio becomes 0.0.
*/
static void
dia_size_selector_set_ratio(DiaSizeSelector *ss, real width, real height)
dia_size_selector_set_ratio(DiaSizeSelector *ss, real width, real height)
{
if (height > 0.0)
if (height > 0.0)
ss->ratio = width/height;
else
else
ss->ratio = 0.0;
}
......@@ -138,7 +137,7 @@ dia_size_selector_lock_pressed(GtkWidget *widget, gpointer data)
{
DiaSizeSelector *ss = DIA_SIZE_SELECTOR(data);
dia_size_selector_set_ratio(ss,
dia_size_selector_set_ratio(ss,
gtk_spin_button_get_value(GTK_SPIN_BUTTON(ss->width)),
gtk_spin_button_get_value(GTK_SPIN_BUTTON(ss->height)));
}
......@@ -169,27 +168,26 @@ dia_size_selector_init (DiaSizeSelector *ss)
gtk_widget_show(GTK_WIDGET(ss->height));
/* Replace label with images */
/* should make sure they're both unallocated when the widget dies.
/* should make sure they're both unallocated when the widget dies.
* That should happen in the "destroy" handler, where both should
* be unref'd */
ss->aspect_locked =
GTK_TOGGLE_BUTTON(dia_toggle_button_new_with_icons
(dia_unbroken_chain_icon,
dia_broken_chain_icon));
ss->aspect_locked = GTK_TOGGLE_BUTTON (
dia_toggle_button_new_with_icon_names ("dia-chain-unbroken",
"dia-chain-broken"));
gtk_container_set_border_width(GTK_CONTAINER(ss->aspect_locked), 0);
gtk_box_pack_start(GTK_BOX(ss), GTK_WIDGET(ss->aspect_locked), FALSE, TRUE, 0);
gtk_box_pack_start(GTK_BOX(ss), GTK_WIDGET(ss->aspect_locked), FALSE, TRUE, 0);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ss->aspect_locked), TRUE);
gtk_widget_show(GTK_WIDGET(ss->aspect_locked));
g_signal_connect (G_OBJECT (ss->aspect_locked), "clicked",
G_CALLBACK (dia_size_selector_lock_pressed), ss);
/* Make sure that the aspect ratio stays the same */
g_signal_connect(G_OBJECT(gtk_spin_button_get_adjustment(ss->width)),
g_signal_connect(G_OBJECT(gtk_spin_button_get_adjustment(ss->width)),
"value_changed",
G_CALLBACK(dia_size_selector_ratio_callback), (gpointer)ss);
g_signal_connect(G_OBJECT(gtk_spin_button_get_adjustment(ss->height)),
g_signal_connect(G_OBJECT(gtk_spin_button_get_adjustment(ss->height)),
"value_changed",
G_CALLBACK(dia_size_selector_ratio_callback), (gpointer)ss);
}
......@@ -211,7 +209,7 @@ dia_size_selector_get_type (void)
0, /* n_preallocs */
(GInstanceInitFunc) dia_size_selector_init
};
dss_type = g_type_register_static (gtk_hbox_get_type (),
"DiaSizeSelector",
&dss_info, 0);
......@@ -230,7 +228,7 @@ dia_size_selector_new (real width, real height)
}
void
dia_size_selector_set_size(DiaSizeSelector *ss, real width, real height)
dia_size_selector_set_size(DiaSizeSelector *ss, real width, real height)
{
gtk_spin_button_set_value(GTK_SPIN_BUTTON(ss->width), width);
gtk_spin_button_set_value(GTK_SPIN_BUTTON(ss->height), height);
......@@ -246,7 +244,7 @@ dia_size_selector_set_locked(DiaSizeSelector *ss, gboolean locked)
{
if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ss->aspect_locked))
&& locked) {
dia_size_selector_set_ratio(ss,
dia_size_selector_set_ratio(ss,
gtk_spin_button_get_value(GTK_SPIN_BUTTON(ss->width)),
gtk_spin_button_get_value(GTK_SPIN_BUTTON(ss->height)));
}
......@@ -273,7 +271,7 @@ dia_alignment_selector_new ()
return omenu;
}
Alignment
Alignment
dia_alignment_selector_get_alignment(GtkWidget *as)
{
return (Alignment)dia_option_menu_get_active (GTK_WIDGET (as));
......@@ -334,7 +332,7 @@ static void
dia_file_selector_class_init (DiaFileSelectorClass *class)
{
GtkWidgetClass *widget_class;
widget_class = (GtkWidgetClass*) class;
widget_class->unrealize = dia_file_selector_unrealize;
......@@ -356,15 +354,15 @@ dia_file_selector_entry_changed(GtkEditable *editable
}
static void
file_open_response_callback(GtkWidget *dialog,
gint response,
file_open_response_callback(GtkWidget *dialog,
gint response,
gpointer user_data)
{
DiaFileSelector *fs =
DIAFILESELECTOR(g_object_get_data(G_OBJECT(dialog), "user_data"));
if (response == GTK_RESPONSE_ACCEPT || response == GTK_RESPONSE_OK) {
gchar *utf8 = g_filename_to_utf8(gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)),
if (response == GTK_RESPONSE_ACCEPT || response == GTK_RESPONSE_OK) {
gchar *utf8 = g_filename_to_utf8(gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)),
-1, NULL, NULL, NULL);
gtk_entry_set_text(GTK_ENTRY(fs->entry), utf8);
g_free(utf8);
......@@ -385,8 +383,8 @@ dia_file_selector_browse_pressed(GtkWidget *widget, gpointer data)
if (fs->dialog == NULL) {
GtkFileFilter *filter;
dialog = fs->dialog =
dialog = fs->dialog =
gtk_file_chooser_dialog_new (_("Select image file"), toplevel ? GTK_WINDOW(toplevel) : NULL,
GTK_FILE_CHOOSER_ACTION_OPEN,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
......@@ -394,10 +392,10 @@ dia_file_selector_browse_pressed(GtkWidget *widget, gpointer data)
NULL);
gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT);
g_signal_connect(G_OBJECT(dialog), "response",
G_CALLBACK(file_open_response_callback), NULL);
G_CALLBACK(file_open_response_callback), NULL);
g_signal_connect (G_OBJECT (fs->dialog), "destroy",
G_CALLBACK (gtk_widget_destroyed), &fs->dialog);
filter = gtk_file_filter_new ();
gtk_file_filter_set_name (filter, _("Supported Formats"));
if (fs->pattern)
......@@ -420,7 +418,7 @@ dia_file_selector_browse_pressed(GtkWidget *widget, gpointer data)
gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(fs->dialog), filename);
g_free(filename);
gtk_widget_show(GTK_WIDGET(fs->dialog));
}
......@@ -463,11 +461,11 @@ dia_file_selector_get_type (void)
0, /* n_preallocs */
(GInstanceInitFunc)dia_file_selector_init,
};
dfs_type = g_type_register_static (gtk_hbox_get_type (),
dfs_type = g_type_register_static (gtk_hbox_get_type (),
"DiaFileSelector",
&dfs_info, 0);
}
}
return dfs_type;
}
......@@ -567,15 +565,15 @@ GtkWidget *
dia_unit_spinner_new(GtkAdjustment *adjustment, DiaUnit adj_unit)
{
DiaUnitSpinner *self;
if (adjustment) {
g_return_val_if_fail (GTK_IS_ADJUSTMENT (adjustment), NULL);
}
self = g_object_new(dia_unit_spinner_get_type(), NULL);
gtk_entry_set_activates_default(GTK_ENTRY(self), TRUE);
self->unit_num = adj_unit;
gtk_spin_button_configure(GTK_SPIN_BUTTON(self),
adjustment, 0.0, units[adj_unit].digits);
......@@ -659,7 +657,7 @@ dia_unit_spinner_get_value(DiaUnitSpinner *self)
}
/* Must manipulate the limit values through this to also consider unit.