Hiroyuki Ikezoe
ikezo****@users*****
Tue Jan 2 19:29:05 JST 2007
Index: kazehakase/src/kazehakase.h diff -u kazehakase/src/kazehakase.h:1.44 kazehakase/src/kazehakase.h:1.45 --- kazehakase/src/kazehakase.h:1.44 Sun Dec 31 19:27:47 2006 +++ kazehakase/src/kazehakase.h Tue Jan 2 19:29:05 2007 @@ -37,20 +37,6 @@ #define HISTORY_DIR G_DIR_SEPARATOR_S"."PACKAGE G_DIR_SEPARATOR_S"history"G_DIR_SEPARATOR_S #define IMAGE_DIR G_DIR_SEPARATOR_S"."PACKAGE G_DIR_SEPARATOR_S"popup"G_DIR_SEPARATOR_S -typedef enum { - KZ_UI_LEVEL_INVALID = 0, - KZ_UI_LEVEL_BEGINNER = 1, - KZ_UI_LEVEL_MEDIUM = 2, - KZ_UI_LEVEL_EXPERT = 4, - KZ_UI_LEVEL_CUSTOM = 8, - KZ_UI_LEVEL_ALL = 0xFFFF -} KzUILevel; - - -KzUILevel kz_ui_level (void); -KzUILevel kz_ui_level_from_str (const gchar *level); -const gchar *kz_ui_level_to_str (KzUILevel level); - extern KzApp *kz_app; #define KZ_CONF_GET(s, k, v, t) \ @@ -69,6 +55,7 @@ (gchar *)v, \ strlen((gchar *)v) + 1, \ KZ_PROFILE_VALUE_TYPE_STRING) +#define KZ_GET_UI_LEVEL kz_app_get_ui_level(kz_app) #define KZ_GET_GLOBAL_PROFILE kz_app_get_profile(kz_app) #define KZ_GET_PROXY kz_app_get_proxy(kz_app) #define KZ_GET_FAVICON kz_app_get_favicon(kz_app) Index: kazehakase/src/kz-app.c diff -u kazehakase/src/kz-app.c:1.15 kazehakase/src/kz-app.c:1.16 --- kazehakase/src/kz-app.c:1.15 Tue Jan 2 18:40:44 2007 +++ kazehakase/src/kz-app.c Tue Jan 2 19:29:05 2007 @@ -490,6 +490,68 @@ return window; } +static KzUILevel +kz_ui_level_from_str (const gchar *level) +{ + if (!level || !*level) + return KZ_UI_LEVEL_INVALID; + + if (!strcmp(level, "custom")) + return KZ_UI_LEVEL_CUSTOM; + else if (!strcmp(level, "expert")) + return KZ_UI_LEVEL_EXPERT; + else if (!strcmp(level, "medium")) + return KZ_UI_LEVEL_MEDIUM; + else if (!strcmp(level, "beginner")) + return KZ_UI_LEVEL_BEGINNER; + + return KZ_UI_LEVEL_INVALID; +} + +#if 0 +static const gchar * +kz_ui_level_to_str (KzUILevel level) +{ + switch (level) + { + case KZ_UI_LEVEL_CUSTOM: + return "custom"; + case KZ_UI_LEVEL_EXPERT: + return "expert"; + case KZ_UI_LEVEL_MEDIUM: + return "medium"; + case KZ_UI_LEVEL_BEGINNER: + return "beginner"; + default: + break; + } + + return NULL; +} +#endif + +KzUILevel +kz_app_get_ui_level (KzApp *app) +{ + KzUILevel val; + gchar level[16]; + KzAppPrivate *priv = KZ_APP_GET_PRIVATE(app); + + g_return_val_if_fail(priv->profile, KZ_UI_LEVEL_BEGINNER); + + level[0] = '\0'; + kz_profile_get_value(priv->profile, + "Global", "ui_level", + level, sizeof(level), + KZ_PROFILE_VALUE_TYPE_STRING); + + val = kz_ui_level_from_str(level); + if (!val) + return KZ_UI_LEVEL_BEGINNER; + + return val; +} + KzFavicon * kz_app_get_favicon (KzApp *app) { Index: kazehakase/src/kz-app.h diff -u kazehakase/src/kz-app.h:1.5 kazehakase/src/kz-app.h:1.6 --- kazehakase/src/kz-app.h:1.5 Tue Jan 2 18:23:46 2007 +++ kazehakase/src/kz-app.h Tue Jan 2 19:29:05 2007 @@ -60,7 +60,16 @@ GtkWidget *kz_app_restore_session (KzApp *app); void kz_app_save_session (KzApp *app); +typedef enum { + KZ_UI_LEVEL_INVALID = 0, + KZ_UI_LEVEL_BEGINNER = 1, + KZ_UI_LEVEL_MEDIUM = 2, + KZ_UI_LEVEL_EXPERT = 4, + KZ_UI_LEVEL_CUSTOM = 8, + KZ_UI_LEVEL_ALL = 0xFFFF +} KzUILevel; +KzUILevel kz_app_get_ui_level (KzApp *app); KzFavicon *kz_app_get_favicon (KzApp *app); KzSearch *kz_app_get_search (KzApp *app); KzRootBookmark *kz_app_get_root_bookmark (KzApp *app); Index: kazehakase/src/kz-prefs-win.c diff -u kazehakase/src/kz-prefs-win.c:1.34 kazehakase/src/kz-prefs-win.c:1.35 --- kazehakase/src/kz-prefs-win.c:1.34 Sun Dec 31 10:36:03 2006 +++ kazehakase/src/kz-prefs-win.c Tue Jan 2 19:29:05 2007 @@ -528,7 +528,7 @@ priv); } - if (!(priv->entry->ui_level & kz_ui_level())) + if (!(priv->entry->ui_level & KZ_GET_UI_LEVEL)) { if (priv->widget) gtk_widget_destroy(priv->widget); @@ -639,7 +639,7 @@ { gint response; - switch (kz_ui_level()) + switch (KZ_GET_UI_LEVEL) { case KZ_UI_LEVEL_BEGINNER: response = KZ_RESPONSE_UI_LEVEL_BEGINNER; @@ -654,7 +654,7 @@ response = KZ_RESPONSE_UI_LEVEL_CUSTOM; break; default: - g_warning("Invalid UI Level: %d", kz_ui_level()); + g_warning("Invalid UI Level: %d", KZ_GET_UI_LEVEL); response = KZ_RESPONSE_UI_LEVEL_BEGINNER; break; } Index: kazehakase/src/kz-window.c diff -u kazehakase/src/kz-window.c:1.285 kazehakase/src/kz-window.c:1.286 --- kazehakase/src/kz-window.c:1.285 Tue Jan 2 18:21:48 2007 +++ kazehakase/src/kz-window.c Tue Jan 2 19:29:05 2007 @@ -689,7 +689,7 @@ priv = KZ_WINDOW_GET_PRIVATE (kz); - switch (kz_ui_level()) + switch (KZ_GET_UI_LEVEL) { case KZ_UI_LEVEL_CUSTOM: action_str = "UILevelCustom"; @@ -1138,8 +1138,7 @@ g_return_if_fail(KZ_IS_WINDOW(kz)); - if (KZ_GET_CURRENT_SESSION) - kz_session_freeze(KZ_SESSION(KZ_GET_CURRENT_SESSION)); + kz_session_freeze(KZ_SESSION(KZ_GET_CURRENT_SESSION)); n_pages = gtk_notebook_get_n_pages(GTK_NOTEBOOK(kz->notebook)); for (i = n_pages - 1; i >= 0; i--) { @@ -1152,8 +1151,7 @@ gtk_widget_destroy(widget); } - if (KZ_GET_CURRENT_SESSION) - kz_session_thaw(KZ_SESSION(KZ_GET_CURRENT_SESSION)); + kz_session_thaw(KZ_SESSION(KZ_GET_CURRENT_SESSION)); } @@ -1477,8 +1475,7 @@ if (kz->tabs) { - if (KZ_GET_CURRENT_SESSION) - kz_bookmark_remove(KZ_GET_CURRENT_SESSION, kz->tabs); + kz_bookmark_remove(KZ_GET_CURRENT_SESSION, kz->tabs); g_object_unref(kz->tabs); kz->tabs = NULL; } Index: kazehakase/src/main.c diff -u kazehakase/src/main.c:1.131 kazehakase/src/main.c:1.132 --- kazehakase/src/main.c:1.131 Tue Jan 2 18:23:46 2007 +++ kazehakase/src/main.c Tue Jan 2 19:29:05 2007 @@ -35,8 +35,6 @@ #include "locale.h" #include "utils.h" -#include "mozilla.h" - KzApp *kz_app = NULL; static gchar** action_array; @@ -59,74 +57,6 @@ /****************************************************************************** * * - * UI Level * - * * - ******************************************************************************/ -KzUILevel -kz_ui_level (void) -{ - KzUILevel val; - gchar level[16]; - - g_return_val_if_fail(KZ_IS_PROFILE(KZ_GET_GLOBAL_PROFILE), - KZ_UI_LEVEL_BEGINNER); - - level[0] = '\0'; - kz_profile_get_value(KZ_GET_GLOBAL_PROFILE, - "Global", "ui_level", - level, sizeof(level), - KZ_PROFILE_VALUE_TYPE_STRING); - - val = kz_ui_level_from_str(level); - if (!val) - return KZ_UI_LEVEL_BEGINNER; - - return val; -} - - -KzUILevel -kz_ui_level_from_str (const gchar *level) -{ - if (!level || !*level) - return KZ_UI_LEVEL_INVALID; - - if (!strcmp(level, "custom")) - return KZ_UI_LEVEL_CUSTOM; - else if (!strcmp(level, "expert")) - return KZ_UI_LEVEL_EXPERT; - else if (!strcmp(level, "medium")) - return KZ_UI_LEVEL_MEDIUM; - else if (!strcmp(level, "beginner")) - return KZ_UI_LEVEL_BEGINNER; - - return KZ_UI_LEVEL_INVALID; -} - - -const gchar * -kz_ui_level_to_str (KzUILevel level) -{ - switch (level) - { - case KZ_UI_LEVEL_CUSTOM: - return "custom"; - case KZ_UI_LEVEL_EXPERT: - return "expert"; - case KZ_UI_LEVEL_MEDIUM: - return "medium"; - case KZ_UI_LEVEL_BEGINNER: - return "beginner"; - default: - break; - } - - return NULL; -} - - -/****************************************************************************** - * * * arguments parser * * * ******************************************************************************/