mirror of
https://gitlab.gnome.org/GNOME/glade.git
synced 2025-09-24 00:04:33 -04:00
- add option "--verbose". - add POPT_AUTOHELP. - use dynamic version of
2004-11-13 Ivan Wong <email@ivanwong.info> * main.c, src/glade.h: - add option "--verbose". - add POPT_AUTOHELP. - use dynamic version of popt on win32. * src/glade-editor.c: Some compilers don't know __FUNCTION__, G_GNUC_FUNCTION is better. * src/glade-gtk.c: - GLADEGTK_API should precede return type. - glade_gtk_button_set_stock() now checks "use-underline" when "stock" is restored to glade-none. * src/glade-menu-editor.c: MSVC doesn't know #warning, use #pragma message for that. * src/glade-property-class.[ch]: - MSVCRT.dll hasn't got strtoll(), use _atoi64() for that. - add orig_def for storing the orginal default value that is overridden by a custom default. * src/glade_plugin.def: added glade_editor_load_widget. * src/glade-editor.c, src/glade-gtk.c, src/glade-parameter.c, src/glade-property-class.c, src/glade-transform.c, src/glade-widget.c: fixed some signed/unsigned mismatch and truncation warnings that only appears in MSVC.
This commit is contained in:
parent
d1c6f73b13
commit
675274fa86
30
ChangeLog
30
ChangeLog
@ -1,3 +1,33 @@
|
||||
2004-11-13 Ivan Wong <email@ivanwong.info>
|
||||
|
||||
* main.c, src/glade.h:
|
||||
- add option "--verbose".
|
||||
- add POPT_AUTOHELP.
|
||||
- use dynamic version of popt on win32.
|
||||
|
||||
* src/glade-editor.c: Some compilers don't know __FUNCTION__,
|
||||
G_GNUC_FUNCTION is better.
|
||||
|
||||
* src/glade-gtk.c:
|
||||
- GLADEGTK_API should precede return type.
|
||||
- glade_gtk_button_set_stock() now checks "use-underline" when "stock"
|
||||
is restored to glade-none.
|
||||
|
||||
* src/glade-menu-editor.c: MSVC doesn't know #warning,
|
||||
use #pragma message for that.
|
||||
|
||||
* src/glade-property-class.[ch]:
|
||||
- MSVCRT.dll hasn't got strtoll(), use _atoi64() for that.
|
||||
- add orig_def for storing the orginal default value that
|
||||
is overridden by a custom default.
|
||||
|
||||
* src/glade_plugin.def: added glade_editor_load_widget.
|
||||
|
||||
* src/glade-editor.c, src/glade-gtk.c, src/glade-parameter.c,
|
||||
src/glade-property-class.c, src/glade-transform.c, src/glade-widget.c:
|
||||
fixed some signed/unsigned mismatch and truncation warnings that only
|
||||
appears in MSVC.
|
||||
|
||||
2004-11-08 Tristan Van Berkom <tristan.van.berkom@gmail.com>
|
||||
|
||||
* src/glade-gtk.c: bug 157289 fixed in regard with boxes and notebooks.
|
||||
|
@ -667,7 +667,7 @@ glade_editor_create_input_enum (GladeEditorProperty *property)
|
||||
GtkWidget *menu;
|
||||
GtkWidget *option_menu;
|
||||
GEnumClass *eclass;
|
||||
gint i;
|
||||
guint i;
|
||||
|
||||
g_return_val_if_fail (property != NULL, NULL);
|
||||
g_return_val_if_fail ((eclass = g_type_class_ref
|
||||
@ -1286,7 +1286,8 @@ glade_editor_property_load_enum (GladeEditorProperty *property)
|
||||
{
|
||||
GladePropertyClass *pclass;
|
||||
GEnumClass *eclass;
|
||||
gint i, value;
|
||||
guint i;
|
||||
gint value;
|
||||
GList *list;
|
||||
|
||||
|
||||
@ -1469,7 +1470,7 @@ glade_editor_property_load (GladeEditorProperty *property, GladeWidget *widget)
|
||||
else if (G_IS_PARAM_SPEC_UNICHAR(class->pspec))
|
||||
glade_editor_property_load_unichar (property);
|
||||
else
|
||||
g_warning ("%s : type %s not implemented (%s)\n", __FUNCTION__,
|
||||
g_warning ("%s : type %s not implemented (%s)\n", G_GNUC_FUNCTION,
|
||||
class->name, g_type_name (class->pspec->value_type));
|
||||
|
||||
glade_editor_property_set_tooltips (property);
|
||||
|
@ -84,7 +84,7 @@ glade_gtk_stock_get_type (void)
|
||||
return etype;
|
||||
}
|
||||
|
||||
GParamSpec *GLADEGTK_API
|
||||
GLADEGTK_API GParamSpec *
|
||||
glade_gtk_stock_spec (void)
|
||||
{
|
||||
return g_param_spec_enum ("stock", "stock", "stock",
|
||||
@ -92,7 +92,7 @@ glade_gtk_stock_spec (void)
|
||||
0, G_PARAM_READWRITE);
|
||||
}
|
||||
|
||||
GParamSpec *GLADEGTK_API
|
||||
GLADEGTK_API GParamSpec *
|
||||
glade_gtk_standard_int_spec (void)
|
||||
{
|
||||
static GParamSpec *int_spec = NULL;
|
||||
@ -103,7 +103,7 @@ glade_gtk_standard_int_spec (void)
|
||||
return int_spec;
|
||||
}
|
||||
|
||||
GParamSpec *GLADEGTK_API
|
||||
GLADEGTK_API GParamSpec *
|
||||
glade_gtk_standard_string_spec (void)
|
||||
{
|
||||
static GParamSpec *str_spec = NULL;
|
||||
@ -113,7 +113,7 @@ glade_gtk_standard_string_spec (void)
|
||||
return str_spec;
|
||||
}
|
||||
|
||||
GParamSpec *GLADEGTK_API
|
||||
GLADEGTK_API GParamSpec *
|
||||
glade_gtk_standard_float_spec (void)
|
||||
{
|
||||
static GParamSpec *float_spec = NULL;
|
||||
@ -401,7 +401,7 @@ glade_gtk_box_set_size (GObject *object, GValue *value)
|
||||
{
|
||||
GtkBox *box;
|
||||
GList *child;
|
||||
gint new_size, old_size, i;
|
||||
guint new_size, old_size, i;
|
||||
|
||||
box = GTK_BOX (object);
|
||||
g_return_if_fail (GTK_IS_BOX (box));
|
||||
@ -796,8 +796,8 @@ glade_gtk_table_set_n_common (GObject *object, GValue *value, gboolean for_rows)
|
||||
for (list = table->children; list && list->data; list = list->next)
|
||||
{
|
||||
GtkTableChild *child = list->data;
|
||||
gint start = for_rows ? child->top_attach : child->left_attach;
|
||||
gint end = for_rows ? child->bottom_attach : child->right_attach;
|
||||
guint start = for_rows ? child->top_attach : child->left_attach;
|
||||
guint end = for_rows ? child->bottom_attach : child->right_attach;
|
||||
|
||||
/* We need to completely remove it */
|
||||
if (start >= new_size)
|
||||
@ -902,7 +902,8 @@ glade_gtk_button_set_stock (GObject *object, GValue *value)
|
||||
GladeProperty *property;
|
||||
GladeProperty *text;
|
||||
GEnumClass *eclass;
|
||||
gint val, i;
|
||||
guint i;
|
||||
gint val;
|
||||
|
||||
val = g_value_get_enum (value);
|
||||
|
||||
@ -934,7 +935,12 @@ glade_gtk_button_set_stock (GObject *object, GValue *value)
|
||||
{
|
||||
GtkWidget *label;
|
||||
|
||||
label = gtk_label_new (g_value_get_string (text->value));
|
||||
if (g_value_get_boolean (
|
||||
glade_widget_get_property (
|
||||
glade_widget, "use-underline")->value))
|
||||
label = gtk_label_new_with_mnemonic (g_value_get_string (text->value));
|
||||
else
|
||||
label = gtk_label_new (g_value_get_string (text->value));
|
||||
gtk_container_add (GTK_CONTAINER (button), label);
|
||||
gtk_widget_show_all (button);
|
||||
}
|
||||
|
@ -184,7 +184,11 @@ glade_menu_editor_destroy (GtkObject *object)
|
||||
g_slist_free (menued->stock_items);
|
||||
menued->stock_items = NULL;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma message ("This should probably chain up to parent's destroy.")
|
||||
#else
|
||||
#warning "This should probably chain up to parent's destroy."
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -309,15 +309,15 @@ glade_parameter_adjustment_new (GladePropertyClass *property_class)
|
||||
switch (def->g_type) {
|
||||
case G_TYPE_FLOAT:
|
||||
value = g_value_get_float (def);
|
||||
step_increment = 0.01;
|
||||
step_increment = 0.01f;
|
||||
break;
|
||||
case G_TYPE_INT:
|
||||
value = (float) g_value_get_int (def);
|
||||
step_increment = 1.0;
|
||||
step_increment = 1.0f;
|
||||
break;
|
||||
case G_TYPE_DOUBLE:
|
||||
value = (float) g_value_get_double (def);
|
||||
step_increment = 0.01;
|
||||
step_increment = 0.01f;
|
||||
break;
|
||||
}
|
||||
page_increment = 10 * step_increment;
|
||||
|
@ -51,14 +51,20 @@ glade_property_class_new (void)
|
||||
property_class->id = NULL;
|
||||
property_class->name = NULL;
|
||||
property_class->tooltip = NULL;
|
||||
property_class->def = NULL;
|
||||
property_class->orig_def = NULL;
|
||||
property_class->parameters = NULL;
|
||||
property_class->query = FALSE;
|
||||
property_class->optional = FALSE;
|
||||
property_class->optional_default = TRUE;
|
||||
property_class->common = FALSE;
|
||||
property_class->packing = FALSE;
|
||||
property_class->is_modified = FALSE;
|
||||
property_class->is_modified = FALSE;
|
||||
property_class->verify_function = NULL;
|
||||
property_class->set_function = NULL;
|
||||
property_class->get_function = NULL;
|
||||
property_class->visible = FALSE;
|
||||
|
||||
return property_class;
|
||||
}
|
||||
@ -92,6 +98,13 @@ glade_property_class_clone (GladePropertyClass *property_class)
|
||||
g_value_copy (property_class->def, clone->def);
|
||||
}
|
||||
|
||||
if (G_IS_VALUE (property_class->orig_def))
|
||||
{
|
||||
clone->orig_def = g_new0 (GValue, 1);
|
||||
g_value_init (clone->orig_def, property_class->pspec->value_type);
|
||||
g_value_copy (property_class->orig_def, clone->orig_def);
|
||||
}
|
||||
|
||||
if (clone->parameters)
|
||||
{
|
||||
GList *parameter;
|
||||
@ -125,6 +138,12 @@ glade_property_class_free (GladePropertyClass *class)
|
||||
g_free (class->id);
|
||||
g_free (class->tooltip);
|
||||
g_free (class->name);
|
||||
if (class->orig_def)
|
||||
{
|
||||
if (G_VALUE_TYPE (class->orig_def) != 0)
|
||||
g_value_unset (class->orig_def);
|
||||
g_free (class->orig_def);
|
||||
}
|
||||
if (class->def)
|
||||
{
|
||||
if (G_VALUE_TYPE (class->def) != 0)
|
||||
@ -154,7 +173,7 @@ glade_property_class_make_string_from_enum (GType etype, gint eval)
|
||||
{
|
||||
GEnumClass *eclass;
|
||||
gchar *string = NULL;
|
||||
gint i;
|
||||
guint i;
|
||||
|
||||
g_return_val_if_fail ((eclass = g_type_class_ref (etype)) != NULL, NULL);
|
||||
for (i = 0; i < eclass->n_values; i++)
|
||||
@ -174,7 +193,7 @@ glade_property_class_make_string_from_flags (GType ftype, guint fval)
|
||||
{
|
||||
GFlagsClass *fclass;
|
||||
gchar *string = NULL;
|
||||
gint i;
|
||||
guint i;
|
||||
g_return_val_if_fail ((fclass = g_type_class_ref (ftype)) != NULL, NULL);
|
||||
|
||||
for (i = 0; i < fclass->n_values; i++)
|
||||
@ -411,9 +430,13 @@ glade_property_class_make_gvalue_from_string (GladePropertyClass *property_class
|
||||
else if (G_IS_PARAM_SPEC_ULONG(property_class->pspec))
|
||||
g_value_set_ulong (value, strtoul (string, NULL, 10));
|
||||
else if (G_IS_PARAM_SPEC_INT64(property_class->pspec))
|
||||
#ifndef G_OS_WIN32
|
||||
g_value_set_int64 (value, strtoll (string, NULL, 10));
|
||||
#else
|
||||
g_value_set_int64 (value, _atoi64 (string));
|
||||
#endif
|
||||
else if (G_IS_PARAM_SPEC_UINT64(property_class->pspec))
|
||||
g_value_set_uint64 (value, strtoull (string, NULL, 10));
|
||||
g_value_set_uint64 (value, g_ascii_strtoull (string, NULL, 10));
|
||||
else if (G_IS_PARAM_SPEC_FLOAT(property_class->pspec))
|
||||
g_value_set_float (value, (float) atof (string));
|
||||
else if (G_IS_PARAM_SPEC_DOUBLE(property_class->pspec))
|
||||
@ -589,11 +612,7 @@ glade_property_class_update_from_node (GladeXmlNode *node,
|
||||
if (buff)
|
||||
{
|
||||
if (class->def)
|
||||
{
|
||||
if (G_VALUE_TYPE (class->def) != 0)
|
||||
g_value_unset (class->def);
|
||||
g_free (class->def);
|
||||
}
|
||||
class->orig_def = class->def;
|
||||
class->def = glade_property_class_make_gvalue_from_string (class, buff);
|
||||
g_free (buff);
|
||||
if (!class->def)
|
||||
|
@ -104,6 +104,9 @@ struct _GladePropertyClass
|
||||
|
||||
GValue *def; /* The default value for this property */
|
||||
|
||||
GValue *orig_def; /* If def is overridden by a xml file,
|
||||
it is the original value, otherwise NULL. */
|
||||
|
||||
GList *parameters; /* list of GladeParameter objects. This list
|
||||
* provides with an extra set of key-value
|
||||
* pairs to specify aspects of this property.
|
||||
|
@ -35,7 +35,7 @@ transform_string_##to_member (const GValue *src_value, \
|
||||
}
|
||||
|
||||
DEFINE_TRANSFORM (double, double, atof)
|
||||
DEFINE_TRANSFORM (float, float, atof)
|
||||
DEFINE_TRANSFORM (float, float, (float) atof)
|
||||
DEFINE_TRANSFORM (int, int, atoi)
|
||||
DEFINE_TRANSFORM (uint, guint, atoi)
|
||||
DEFINE_TRANSFORM (long, long, atol)
|
||||
|
@ -349,7 +349,7 @@ glade_widget_build_object (GladeWidgetClass *klass, GladeWidget *widget)
|
||||
GladeProperty *glade_property;
|
||||
GladePropertyClass *glade_property_class;
|
||||
GObject *object;
|
||||
gint n_props, i;
|
||||
guint n_props, i;
|
||||
|
||||
/* As a slight optimization, we never unref the class
|
||||
*/
|
||||
|
@ -121,4 +121,6 @@
|
||||
#define GLADE_XML_TAG_PLACEHOLDER "placeholder"
|
||||
#define GLADE_XML_TAG_INTERNAL_CHILD "internal-child"
|
||||
|
||||
extern gboolean verbose;
|
||||
|
||||
#endif /* __GLADE_H__ */
|
||||
|
@ -3,6 +3,7 @@ EXPORTS
|
||||
glade_catalog_load_all
|
||||
glade_command_create
|
||||
glade_cursor_init
|
||||
glade_editor_load_widget
|
||||
glade_placeholder_get_type
|
||||
glade_placeholder_new
|
||||
glade_project_get_tooltips
|
||||
|
70
src/main.c
70
src/main.c
@ -44,27 +44,24 @@
|
||||
#endif
|
||||
|
||||
static gchar *widget_name = NULL;
|
||||
gboolean verbose = FALSE;
|
||||
|
||||
#ifdef HAVE_LIBPOPT
|
||||
static struct poptOption options[] = {
|
||||
{
|
||||
"dump",
|
||||
'\0',
|
||||
POPT_ARG_STRING,
|
||||
&widget_name,
|
||||
0,
|
||||
"Dump the properties of a widget. --dump [gtk type] where type can be GtkWindow, GtkLabel etc.",
|
||||
NULL
|
||||
},
|
||||
{
|
||||
NULL,
|
||||
'\0',
|
||||
0,
|
||||
NULL,
|
||||
0,
|
||||
NULL,
|
||||
NULL
|
||||
}
|
||||
{ "dump", '\0', POPT_ARG_STRING, &widget_name, 0,
|
||||
N_("dump the properties of a widget. --dump [gtk type] "
|
||||
"where type can be GtkWindow, GtkLabel etc."), NULL },
|
||||
{ "verbose", 'v', POPT_ARG_NONE, &verbose, 0,
|
||||
N_("be verbose."), NULL },
|
||||
#ifndef USE_POPT_DLL
|
||||
POPT_AUTOHELP
|
||||
#else
|
||||
/* poptHelpOptions can not be resolved during linking on Win32,
|
||||
get it at runtime. */
|
||||
{ NULL, '\0', POPT_ARG_INCLUDE_TABLE, 0, 0,
|
||||
N_("Help options:"), NULL },
|
||||
#endif
|
||||
POPT_TABLEEND
|
||||
};
|
||||
|
||||
static GList *
|
||||
@ -141,17 +138,17 @@ main (int argc, char *argv[])
|
||||
poptContext popt_context;
|
||||
#endif
|
||||
#ifdef G_OS_WIN32
|
||||
gchar *prefix;
|
||||
gchar *prefix;
|
||||
|
||||
prefix = g_win32_get_package_installation_directory (NULL, NULL);
|
||||
g_glade_data_dir = g_build_filename (prefix, "share", "glade", NULL);
|
||||
g_pixmaps_dir = g_build_filename (prefix, "lib", PACKAGE "-" VERSION, "pixmaps", NULL);
|
||||
g_widgets_dir = g_build_filename (prefix, "lib", PACKAGE "-" VERSION, "widgets", NULL);
|
||||
g_catalogs_dir = g_build_filename (prefix, "lib", PACKAGE "-" VERSION, "catalogs", NULL);
|
||||
g_modules_dir = g_build_filename (prefix, "lib", "glade", NULL);
|
||||
g_glade_localedir = g_build_filename (prefix, "lib", "locale", NULL);
|
||||
g_glade_icondir = g_build_filename (prefix, "share", "pixmaps", NULL);
|
||||
g_free (prefix);
|
||||
prefix = g_win32_get_package_installation_directory (NULL, NULL);
|
||||
g_glade_data_dir = g_build_filename (prefix, "share", "glade", NULL);
|
||||
g_pixmaps_dir = g_build_filename (prefix, "lib", PACKAGE "-" VERSION, "pixmaps", NULL);
|
||||
g_widgets_dir = g_build_filename (prefix, "lib", PACKAGE "-" VERSION, "widgets", NULL);
|
||||
g_catalogs_dir = g_build_filename (prefix, "lib", PACKAGE "-" VERSION, "catalogs", NULL);
|
||||
g_modules_dir = g_build_filename (prefix, "lib", "glade", NULL);
|
||||
g_glade_localedir = g_build_filename (prefix, "lib", "locale", NULL);
|
||||
g_glade_icondir = g_build_filename (prefix, "share", "pixmaps", NULL);
|
||||
g_free (prefix);
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_NLS
|
||||
@ -164,6 +161,9 @@ main (int argc, char *argv[])
|
||||
g_set_application_name (_("Glade-3 GUI Builder"));
|
||||
|
||||
#ifdef HAVE_LIBPOPT
|
||||
# ifdef USE_POPT_DLL
|
||||
options[sizeof (options) / sizeof (options[0]) - 2].arg = poptHelpOptions;
|
||||
# endif
|
||||
popt_context = poptGetContext ("Glade3", argc, (const char **) argv, options, 0);
|
||||
files = parse_command_line (popt_context);
|
||||
poptFreeContext (popt_context);
|
||||
@ -198,13 +198,13 @@ main (int argc, char *argv[])
|
||||
gtk_main ();
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
g_free (g_glade_data_dir);
|
||||
g_free (g_pixmaps_dir);
|
||||
g_free (g_widgets_dir);
|
||||
g_free (g_catalogs_dir);
|
||||
g_free (g_modules_dir);
|
||||
g_free (g_glade_localedir);
|
||||
g_free (g_glade_icondir);
|
||||
g_free (g_glade_data_dir);
|
||||
g_free (g_pixmaps_dir);
|
||||
g_free (g_widgets_dir);
|
||||
g_free (g_catalogs_dir);
|
||||
g_free (g_modules_dir);
|
||||
g_free (g_glade_localedir);
|
||||
g_free (g_glade_icondir);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user