devhelp r1137 - in trunk: . src
- From: rhult svn gnome org
- To: svn-commits-list gnome org
- Subject: devhelp r1137 - in trunk: . src
- Date: Sat, 4 Oct 2008 19:29:47 +0000 (UTC)
Author: rhult
Date: Sat Oct 4 19:29:47 2008
New Revision: 1137
URL: http://svn.gnome.org/viewvc/devhelp?rev=1137&view=rev
Log:
2008-10-04 Richard Hult <richard imendio com>
* src/dh-base.c:
* src/dh-preferences.[ch]:
* src/dh-window.c: Get rid of dh_preferences_init(), init on
demand. Rename the conf keys to DH_CONF_*.
Modified:
trunk/ChangeLog
trunk/src/dh-base.c
trunk/src/dh-preferences.c
trunk/src/dh-preferences.h
trunk/src/dh-window.c
Modified: trunk/src/dh-base.c
==============================================================================
--- trunk/src/dh-base.c (original)
+++ trunk/src/dh-base.c Sat Oct 4 19:29:47 2008
@@ -423,7 +423,6 @@
base_instance = g_object_new (DH_TYPE_BASE, NULL);
base_init_books (base_instance);
- dh_preferences_init ();
}
return base_instance;
Modified: trunk/src/dh-preferences.c
==============================================================================
--- trunk/src/dh-preferences.c (original)
+++ trunk/src/dh-preferences.c Sat Oct 4 19:29:47 2008
@@ -66,6 +66,14 @@
static DhPreferences *prefs;
static void
+preferences_init (void)
+{
+ if (!prefs) {
+ prefs = g_new0 (DhPreferences, 1);
+ }
+}
+
+static void
preferences_font_set_cb (GtkFontButton *button, gpointer user_data)
{
DhPreferences *prefs = user_data;
@@ -75,9 +83,9 @@
font_name = gtk_font_button_get_font_name (button);
if (GTK_WIDGET (button) == prefs->variable_font_button) {
- key = GCONF_VARIABLE_FONT;
+ key = DH_CONF_VARIABLE_FONT;
} else {
- key = GCONF_FIXED_FONT;
+ key = DH_CONF_FIXED_FONT;
}
ige_conf_set_string (ige_conf_get (), key, font_name);
@@ -107,7 +115,7 @@
active = gtk_toggle_button_get_active (button);
ige_conf_set_bool (ige_conf_get (),
- GCONF_USE_SYSTEM_FONTS,
+ DH_CONF_USE_SYSTEM_FONTS,
active);
gtk_widget_set_sensitive (prefs->fonts_table, !active);
@@ -123,7 +131,7 @@
gchar *font_name;
ige_conf_get_bool (ige_conf_get (),
- GCONF_USE_SYSTEM_FONTS,
+ DH_CONF_USE_SYSTEM_FONTS,
&use_system_fonts);
if (prefs->variable_font_button) {
@@ -150,7 +158,7 @@
gchar *font_name;
ige_conf_get_bool (ige_conf_get (),
- GCONF_USE_SYSTEM_FONTS,
+ DH_CONF_USE_SYSTEM_FONTS,
&use_system_fonts);
if (prefs->fixed_font_button) {
@@ -198,27 +206,27 @@
prefs->use_system_fonts_id =
ige_conf_notify_add (conf,
- GCONF_USE_SYSTEM_FONTS,
+ DH_CONF_USE_SYSTEM_FONTS,
preferences_use_system_font_notify_cb,
prefs);
prefs->system_var_id =
ige_conf_notify_add (conf,
- GCONF_SYSTEM_VARIABLE_FONT,
+ DH_CONF_SYSTEM_VARIABLE_FONT,
preferences_var_font_notify_cb,
prefs);
prefs->system_fixed_id =
ige_conf_notify_add (conf,
- GCONF_SYSTEM_FIXED_FONT,
+ DH_CONF_SYSTEM_FIXED_FONT,
preferences_fixed_font_notify_cb,
prefs);
prefs->var_id =
ige_conf_notify_add (conf,
- GCONF_VARIABLE_FONT,
+ DH_CONF_VARIABLE_FONT,
preferences_var_font_notify_cb,
prefs);
prefs->fixed_id =
ige_conf_notify_add (conf,
- GCONF_FIXED_FONT,
+ DH_CONF_FIXED_FONT,
preferences_fixed_font_notify_cb,
prefs);
}
@@ -235,17 +243,17 @@
if (use_system_fonts) {
ige_conf_get_string (conf,
- GCONF_SYSTEM_VARIABLE_FONT,
+ DH_CONF_SYSTEM_VARIABLE_FONT,
&var_font_name);
ige_conf_get_string (conf,
- GCONF_SYSTEM_FIXED_FONT,
+ DH_CONF_SYSTEM_FIXED_FONT,
&fixed_font_name);
} else {
ige_conf_get_string (conf,
- GCONF_VARIABLE_FONT,
+ DH_CONF_VARIABLE_FONT,
&var_font_name);
ige_conf_get_string (conf,
- GCONF_FIXED_FONT,
+ DH_CONF_FIXED_FONT,
&fixed_font_name);
}
@@ -264,7 +272,7 @@
conf = ige_conf_get ();
ige_conf_get_bool (conf,
- GCONF_USE_SYSTEM_FONTS,
+ DH_CONF_USE_SYSTEM_FONTS,
&use_system_fonts);
preferences_get_font_names (use_system_fonts,
@@ -280,18 +288,10 @@
}
void
-dh_preferences_init (void)
-{
- if (prefs) {
- return;
- }
-
- prefs = g_new0 (DhPreferences, 1);
-}
-
-void
dh_preferences_setup_fonts (void)
{
+ preferences_init ();
+
preferences_update_fonts (NULL);
preferences_connect_conf_listeners ();
}
@@ -304,6 +304,8 @@
gchar *var_font_name, *fixed_font_name;
GladeXML *gui;
+ preferences_init ();
+
if (prefs->dialog != NULL) {
/* Do something useful, although it should be visible at
* this point anyway.
@@ -333,7 +335,7 @@
NULL);
ige_conf_get_bool (ige_conf_get (),
- GCONF_USE_SYSTEM_FONTS,
+ DH_CONF_USE_SYSTEM_FONTS,
&use_system_fonts);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (prefs->system_fonts_button),
use_system_fonts);
Modified: trunk/src/dh-preferences.h
==============================================================================
--- trunk/src/dh-preferences.h (original)
+++ trunk/src/dh-preferences.h Sat Oct 4 19:29:47 2008
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
/*
- * Copyright (C) 2004-2006 Imendio AB
+ * Copyright (C) 2004-2008 Imendio AB
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -23,23 +23,22 @@
#include <gtk/gtk.h>
-#define GCONF_PATH "/apps/devhelp"
+#define DH_CONF_PATH "/apps/devhelp"
-#define GCONF_MAIN_WINDOW_MAXIMIZED "/apps/devhelp/ui/main_window_maximized"
-#define GCONF_MAIN_WINDOW_WIDTH "/apps/devhelp/ui/main_window_width"
-#define GCONF_MAIN_WINDOW_HEIGHT "/apps/devhelp/ui/main_window_height"
-#define GCONF_MAIN_WINDOW_POS_X "/apps/devhelp/ui/main_window_position_x"
-#define GCONF_MAIN_WINDOW_POS_Y "/apps/devhelp/ui/main_window_position_y"
-#define GCONF_PANED_LOCATION "/apps/devhelp/ui/paned_location"
-#define GCONF_SELECTED_TAB "/apps/devhelp/ui/selected_tab"
-#define GCONF_USE_SYSTEM_FONTS "/apps/devhelp/ui/use_system_fonts"
-#define GCONF_ADVANCED_OPTIONS "/apps/devhelp/ui/show_advanced_search_options"
-#define GCONF_VARIABLE_FONT "/apps/devhelp/ui/variable_font"
-#define GCONF_FIXED_FONT "/apps/devhelp/ui/fixed_font"
-#define GCONF_SYSTEM_VARIABLE_FONT "/desktop/gnome/interface/font_name"
-#define GCONF_SYSTEM_FIXED_FONT "/desktop/gnome/interface/monospace_font_name"
+#define DH_CONF_MAIN_WINDOW_MAXIMIZED DH_CONF_PATH "/ui/main_window_maximized"
+#define DH_CONF_MAIN_WINDOW_WIDTH DH_CONF_PATH "/ui/main_window_width"
+#define DH_CONF_MAIN_WINDOW_HEIGHT DH_CONF_PATH "/ui/main_window_height"
+#define DH_CONF_MAIN_WINDOW_POS_X DH_CONF_PATH "/ui/main_window_position_x"
+#define DH_CONF_MAIN_WINDOW_POS_Y DH_CONF_PATH "/ui/main_window_position_y"
+#define DH_CONF_PANED_LOCATION DH_CONF_PATH "/ui/paned_location"
+#define DH_CONF_SELECTED_TAB DH_CONF_PATH "/ui/selected_tab"
+#define DH_CONF_USE_SYSTEM_FONTS DH_CONF_PATH "/ui/use_system_fonts"
+#define DH_CONF_ADVANCED_OPTIONS DH_CONF_PATH "/ui/show_advanced_search_options"
+#define DH_CONF_VARIABLE_FONT DH_CONF_PATH "/ui/variable_font"
+#define DH_CONF_FIXED_FONT DH_CONF_PATH "/ui/fixed_font"
+#define DH_CONF_SYSTEM_VARIABLE_FONT "/desktop/gnome/interface/font_name"
+#define DH_CONF_SYSTEM_FIXED_FONT "/desktop/gnome/interface/monospace_font_name"
-void dh_preferences_init (void);
void dh_preferences_setup_fonts (void);
void dh_preferences_show_dialog (GtkWindow *parent);
Modified: trunk/src/dh-window.c
==============================================================================
--- trunk/src/dh-window.c (original)
+++ trunk/src/dh-window.c Sat Oct 4 19:29:47 2008
@@ -671,7 +671,7 @@
gtk_box_pack_start (GTK_BOX (priv->main_box), priv->hpaned, TRUE, TRUE, 0);
ige_conf_get_int (ige_conf_get (),
- GCONF_PANED_LOCATION,
+ DH_CONF_PANED_LOCATION,
&hpaned_position);
/* This workaround for broken schema installs is not really working that
@@ -795,7 +795,7 @@
}
ige_conf_set_bool (ige_conf_get (),
- GCONF_MAIN_WINDOW_MAXIMIZED, maximized);
+ DH_CONF_MAIN_WINDOW_MAXIMIZED, maximized);
/* If maximized don't save the size and position. */
if (!maximized) {
@@ -804,27 +804,27 @@
gtk_window_get_size (GTK_WINDOW (window), &width, &height);
ige_conf_set_int (ige_conf_get (),
- GCONF_MAIN_WINDOW_WIDTH, width);
+ DH_CONF_MAIN_WINDOW_WIDTH, width);
ige_conf_set_int (ige_conf_get (),
- GCONF_MAIN_WINDOW_HEIGHT, height);
+ DH_CONF_MAIN_WINDOW_HEIGHT, height);
gtk_window_get_position (GTK_WINDOW (window), &x, &y);
ige_conf_set_int (ige_conf_get (),
- GCONF_MAIN_WINDOW_POS_X, x);
+ DH_CONF_MAIN_WINDOW_POS_X, x);
ige_conf_set_int (ige_conf_get (),
- GCONF_MAIN_WINDOW_POS_Y, y);
+ DH_CONF_MAIN_WINDOW_POS_Y, y);
}
ige_conf_set_int (ige_conf_get (),
- GCONF_PANED_LOCATION,
+ DH_CONF_PANED_LOCATION,
gtk_paned_get_position (GTK_PANED (priv->hpaned)));
if (gtk_notebook_get_current_page (GTK_NOTEBOOK (priv->control_notebook)) == 0) {
ige_conf_set_string (ige_conf_get (),
- GCONF_SELECTED_TAB, "content");
+ DH_CONF_SELECTED_TAB, "content");
} else {
ige_conf_set_string (ige_conf_get (),
- GCONF_SELECTED_TAB, "search");
+ DH_CONF_SELECTED_TAB, "search");
}
}
@@ -840,7 +840,7 @@
priv = window->priv;
ige_conf_get_int (ige_conf_get (),
- GCONF_MAIN_WINDOW_WIDTH,
+ DH_CONF_MAIN_WINDOW_WIDTH,
&width);
if (width <= 0) {
@@ -848,7 +848,7 @@
}
ige_conf_get_int (ige_conf_get (),
- GCONF_MAIN_WINDOW_HEIGHT,
+ DH_CONF_MAIN_WINDOW_HEIGHT,
&height);
if (height <= 0) {
@@ -859,23 +859,23 @@
width, height);
ige_conf_get_int (ige_conf_get (),
- GCONF_MAIN_WINDOW_POS_X,
+ DH_CONF_MAIN_WINDOW_POS_X,
&x);
ige_conf_get_int (ige_conf_get (),
- GCONF_MAIN_WINDOW_POS_Y,
+ DH_CONF_MAIN_WINDOW_POS_Y,
&y);
gtk_window_move (GTK_WINDOW (window), x, y);
ige_conf_get_bool (ige_conf_get (),
- GCONF_MAIN_WINDOW_MAXIMIZED,
+ DH_CONF_MAIN_WINDOW_MAXIMIZED,
&maximized);
if (maximized) {
gtk_window_maximize (GTK_WINDOW (window));
}
ige_conf_get_string (ige_conf_get (),
- GCONF_SELECTED_TAB,
+ DH_CONF_SELECTED_TAB,
&tab);
if (!tab || strcmp (tab, "") == 0 || strcmp (tab, "content") == 0) {
gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->control_notebook), 0);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]