Commit 818c0509 authored by Morten Welinder's avatar Morten Welinder

Conf: now it compiles and links!

parent ff78c690
......@@ -268,7 +268,7 @@ go_plugin_init (GOPlugin *plugin, GOCmdContext *cc)
#endif
module = go_plugin_get_type_module (plugin);
go_gnm_component_register_type (module);
gnm_init (FALSE);
gnm_init ();
if (!gnm_sys_data_dir ())
gutils_init ();
dir_list = go_slist_create (
......@@ -276,8 +276,9 @@ go_plugin_init (GOPlugin *plugin, GOCmdContext *cc)
(gnm_usr_dir () == NULL ? NULL :
g_build_filename (gnm_usr_dir (), PLUGIN_SUBDIR, NULL)),
NULL);
dir_list = g_slist_concat (dir_list,
go_string_slist_copy (gnm_app_prefs->plugin_extra_dirs));
dir_list = g_slist_concat
(dir_list,
go_string_slist_copy (gnm_conf_get_autoformat_extra_dirs ()));
env_var = g_getenv ("GNUMERIC_PLUGIN_PATH");
if (env_var != NULL)
......@@ -287,10 +288,10 @@ go_plugin_init (GOPlugin *plugin, GOCmdContext *cc)
/* WHERE IS THIS DEFINED */
go_plugins_add (go_component_get_command_context (),
gnm_app_prefs->plugin_file_states,
gnm_app_prefs->active_plugins,
dir_list,
gnm_plugin_loader_module_get_type ());
gnm_conf_get_plugins_file_states (),
gnm_conf_get_plugins_active (),
dir_list,
gnm_plugin_loader_module_get_type ());
}
G_MODULE_EXPORT void
......
......@@ -38,6 +38,7 @@
#include <number-match.h>
#include <string.h>
#include <sheet.h>
#include <print-info.h>
#define NO_DEBUG_GCONF
#ifndef NO_DEBUG_GCONF
......@@ -78,7 +79,7 @@ gnm_conf_init (void)
void
gnm_conf_shutdown (void)
{
gnm_gconf_set_page_setup (NULL);
gnm_conf_set_page_setup (NULL);
g_hash_table_destroy (string_pool);
string_pool = NULL;
......@@ -97,16 +98,41 @@ gnm_conf_get_root (void)
}
GtkPageSetup *
gnm_gconf_get_page_setup (void)
gnm_conf_get_page_setup (void)
{
if (!page_setup) {
page_setup = gtk_page_setup_new ();
page_setup_set_paper (page_setup,
gnm_conf_get_printsetup_paper ());
gtk_page_setup_set_orientation
(page_setup,
gnm_conf_get_printsetup_paper_orientation ());
gtk_page_setup_set_top_margin
(page_setup,
gnm_conf_get_printsetup_margin_gtk_top (),
GTK_UNIT_POINTS);
gtk_page_setup_set_bottom_margin
(page_setup,
gnm_conf_get_printsetup_margin_gtk_bottom (),
GTK_UNIT_POINTS);
gtk_page_setup_set_left_margin
(page_setup,
gnm_conf_get_printsetup_margin_gtk_left (),
GTK_UNIT_POINTS);
gtk_page_setup_set_right_margin
(page_setup,
gnm_conf_get_printsetup_margin_gtk_right (),
GTK_UNIT_POINTS);
}
return page_setup;
}
void
gnm_gconf_set_page_setup (GtkPageSetup *setup)
gnm_conf_set_page_setup (GtkPageSetup *setup)
{
if (page_setup) {
g_object_unref (page_setup);
......@@ -114,10 +140,25 @@ gnm_gconf_set_page_setup (GtkPageSetup *setup)
}
if (setup) {
char *paper;
page_setup = gtk_page_setup_copy (setup);
paper = page_setup_get_paper (setup);
gnm_conf_set_printsetup_paper (paper);
g_free (paper);
gnm_conf_set_printsetup_paper_orientation
(gtk_page_setup_get_orientation (setup));
gnm_conf_set_printsetup_margin_gtk_top
(gtk_page_setup_get_top_margin (setup, GTK_UNIT_POINTS));
gnm_conf_set_printsetup_margin_gtk_bottom
(gtk_page_setup_get_bottom_margin (setup, GTK_UNIT_POINTS));
gnm_conf_set_printsetup_margin_gtk_left
(gtk_page_setup_get_left_margin (setup, GTK_UNIT_POINTS));
gnm_conf_set_printsetup_margin_gtk_right
(gtk_page_setup_get_right_margin (setup, GTK_UNIT_POINTS));
}
}
......@@ -138,6 +179,105 @@ gnm_conf_get_printer_decoration_font (void)
return style;
}
#define TOOLBAR_TANGO(Object,Format,Standard) \
if (strcmp (name, "Object") == 0) \
Object \
else if (strcmp (name, "Format") == 0) \
Format \
else if (strcmp (name, "Standard") == 0) \
Standard
gboolean
gnm_conf_get_toolbar_visible (const char *name)
{
TOOLBAR_TANGO
(return gnm_conf_get_core_gui_toolbars_ObjectToolbar ();,
return gnm_conf_get_core_gui_toolbars_FormatToolbar ();,
return gnm_conf_get_core_gui_toolbars_StandardToolbar (););
return FALSE;
}
void
gnm_conf_set_toolbar_visible (const char *name, gboolean x)
{
TOOLBAR_TANGO
(gnm_conf_set_core_gui_toolbars_ObjectToolbar (x);,
gnm_conf_set_core_gui_toolbars_FormatToolbar (x);,
gnm_conf_set_core_gui_toolbars_StandardToolbar (x););
}
GtkPositionType
gnm_conf_get_toolbar_position (const char *name)
{
TOOLBAR_TANGO
(return gnm_conf_get_core_gui_toolbars_ObjectToolbar_position ();,
return gnm_conf_get_core_gui_toolbars_FormatToolbar_position ();,
return gnm_conf_get_core_gui_toolbars_StandardToolbar_position (););
return GTK_POS_TOP;
}
void
gnm_conf_set_toolbar_position (const char *name, GtkPositionType x)
{
TOOLBAR_TANGO
(gnm_conf_set_core_gui_toolbars_ObjectToolbar_position (x);,
gnm_conf_set_core_gui_toolbars_FormatToolbar_position (x);,
gnm_conf_set_core_gui_toolbars_StandardToolbar_position (x););
}
#undef TOOLBAR_TANGO
GtkPrintSettings *
gnm_conf_get_print_settings (void)
{
GtkPrintSettings *settings = gtk_print_settings_new ();
GSList *list = gnm_conf_get_printsetup_gtk_setting ();
while (list && list->next) {
const char *value = list->data;
const char *key = list->next->data;
list = list->next->next;
gtk_print_settings_set (settings, key, value);
}
return settings;
}
static void
gnm_gconf_set_print_settings_cb (const gchar *key, const gchar *value, gpointer user_data)
{
GSList **list = user_data;
*list = g_slist_prepend (*list, g_strdup (key));
*list = g_slist_prepend (*list, g_strdup (value));
}
void
gnm_conf_set_print_settings (GtkPrintSettings *settings)
{
GSList *list = NULL;
gtk_print_settings_foreach (settings, gnm_gconf_set_print_settings_cb, &list);
gnm_conf_set_printsetup_gtk_setting (list);
go_slist_free_custom (list, g_free);
}
gboolean
gnm_conf_get_detachable_toolbars (void)
{
#ifdef WIN32
return FALSE;
#else
return go_conf_get_bool
(root,
"/desktop/gnome/interface/toolbar_detachable");
#endif
}
/* ------------------------------------------------------------------------- */
GtkToolbarStyle
......
......@@ -10,11 +10,24 @@ void gnm_conf_init (void);
void gnm_conf_shutdown (void);
GOConfNode *gnm_conf_get_root (void);
GtkPageSetup *gnm_gconf_get_page_setup (void);
void gnm_gconf_set_page_setup (GtkPageSetup *setup);
/* Convenience APIs */
GtkPageSetup *gnm_conf_get_page_setup (void);
void gnm_conf_set_page_setup (GtkPageSetup *setup);
GtkPrintSettings *gnm_conf_get_print_settings (void);
void gnm_conf_set_print_settings (GtkPrintSettings *settings);
GnmStyle *gnm_conf_get_printer_decoration_font (void);
gboolean gnm_conf_get_toolbar_visible (const char *name);
void gnm_conf_set_toolbar_visible (const char *name, gboolean x);
GtkPositionType gnm_conf_get_toolbar_position (const char *name);
void gnm_conf_set_toolbar_position (const char *name, GtkPositionType x);
gboolean gnm_conf_get_detachable_toolbars (void);
/* ----------- AUTOMATICALLY GENERATED CODE BELOW -- DO NOT EDIT ----------- */
GtkToolbarStyle gnm_conf_get_toolbar_style (void);
......
......@@ -232,7 +232,7 @@ print_info_load_defaults (PrintInformation *res)
if (res->page_setup != NULL)
return res;
res->page_setup = gtk_page_setup_copy (gnm_gconf_get_page_setup ());
res->page_setup = gtk_page_setup_copy (gnm_conf_get_page_setup ());
res->scaling.type = gnm_conf_get_printsetup_scale_percentage ()
? PRINT_SCALE_PERCENTAGE
......@@ -400,7 +400,7 @@ print_info_save (PrintInformation *pi)
gnm_conf_set_printsetup_footer (l);
g_slist_free (l);
gnm_gconf_set_page_setup (pi->page_setup);
gnm_conf_set_page_setup (pi->page_setup);
}
GtkUnit
......
......@@ -1555,9 +1555,7 @@ gnm_print_sheet (WorkbookControl *wbc, Sheet *sheet,
pi->wbc = wbc ? WORKBOOK_CONTROL (wbc) : NULL;
pi->sheet = sheet;
gnm_gconf_init_printer_defaults ();
settings = gnm_gconf_get_print_settings ();
settings = gnm_conf_get_print_settings ();
gtk_print_settings_set_int (settings, GNUMERIC_PRINT_SETTING_PRINTRANGE_KEY,
default_range);
pi->pr = default_range;
......@@ -1611,7 +1609,7 @@ gnm_print_sheet (WorkbookControl *wbc, Sheet *sheet,
switch (res) {
case GTK_PRINT_OPERATION_RESULT_APPLY:
gnm_gconf_set_print_settings (gtk_print_operation_get_print_settings (print));
gnm_conf_set_print_settings (gtk_print_operation_get_print_settings (print));
break;
case GTK_PRINT_OPERATION_RESULT_CANCEL:
printing_instance_delete (pi);
......
......@@ -3448,7 +3448,7 @@ set_toolbar_position (GtkToolbar *tb, GtkPositionType pos, WBCGtk *gtk)
g_object_unref (box);
if (zone)
gnm_gconf_set_toolbar_position (name, pos);
gnm_conf_set_toolbar_position (name, pos);
}
static void
......@@ -3584,7 +3584,7 @@ cb_toolbar_box_visible (GtkWidget *box, G_GNUC_UNUSED GParamSpec *pspec,
* We do not persist changes made going-to/while-in/leaving
* fullscreen mode.
*/
gnm_gconf_set_toolbar_visible (name, visible);
gnm_conf_set_toolbar_visible (name, visible);
}
}
......@@ -3598,7 +3598,7 @@ cb_add_menus_toolbars (G_GNUC_UNUSED GtkUIManager *ui,
GtkToggleActionEntry entry;
char *toggle_name = g_strconcat ("ViewMenuToolbar", name, NULL);
char *tooltip = g_strdup_printf (_("Show/Hide toolbar %s"), _(name));
gboolean visible = gnm_gconf_get_toolbar_visible (name);
gboolean visible = gnm_conf_get_toolbar_visible (name);
#ifdef GNM_USE_HILDON
hildon_window_add_toolbar (HILDON_WINDOW (wbcg_toplevel (wbcg)), GTK_TOOLBAR (w));
......@@ -3608,9 +3608,9 @@ cb_add_menus_toolbars (G_GNUC_UNUSED GtkUIManager *ui,
g_strdup (toggle_name), g_object_ref (w));
#else
GtkWidget *box;
GtkPositionType pos = gnm_gconf_get_toolbar_position (name);
GtkPositionType pos = gnm_conf_get_toolbar_position (name);
if (gnm_app_detachable_toolbars ()) {
if (gnm_conf_get_detachable_toolbars ()) {
box = gtk_handle_box_new ();
g_object_connect (box,
"signal::child_attached", G_CALLBACK (cb_handlebox_dock_status), GINT_TO_POINTER (TRUE),
......
......@@ -40,6 +40,7 @@ my %type_to_ctype =
'GO_TYPE_DIRECTION' => 'GODirection',
'GTK_TYPE_UNIT' => 'GtkUnit',
'GTK_TYPE_TOOLBAR_STYLE' => 'GtkToolbarStyle',
'GTK_TYPE_POSITION' => 'GtkPositionType',
);
my %extra_attributes =
......@@ -64,16 +65,19 @@ my %extra_attributes =
},
'/apps/gnumeric/core/gui/toolbars/FormatToolbar-position' => {
'gtype' => 'GTK_TYPE_POSITION',
'min' => 0,
'max' => 3,
},
'/apps/gnumeric/core/gui/toolbars/ObjectToolbar-position' => {
'gtype' => 'GTK_TYPE_POSITION',
'min' => 0,
'max' => 3,
},
'/apps/gnumeric/core/gui/toolbars/StandardToolbar-position' => {
'gtype' => 'GTK_TYPE_POSITION',
'min' => 0,
'max' => 3,
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment