svnno****@sourc*****
svnno****@sourc*****
Sun Apr 15 00:08:46 JST 2007
Revision: 3186 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=kazehakase&view=rev&rev=3186 Author: kous Date: 2007-04-15 00:08:45 +0900 (Sun, 15 Apr 2007) Log Message: ----------- * src/kz-app.[ch] (kz_app_get): added. * src/kz-window.c, src/main.c, src/actions/kz-actions-popup.c, src/actions/kz-actions.c, src/kz-notebook.c, src/widget/kz-thumbnail.c, src/kazehakase.h: don't use kz_app global variable. Modified Paths: -------------- kazehakase/trunk/ChangeLog kazehakase/trunk/src/actions/kz-actions-popup.c kazehakase/trunk/src/actions/kz-actions.c kazehakase/trunk/src/kazehakase.h kazehakase/trunk/src/kz-app.c kazehakase/trunk/src/kz-app.h kazehakase/trunk/src/kz-notebook.c kazehakase/trunk/src/kz-window.c kazehakase/trunk/src/main.c kazehakase/trunk/src/widget/kz-thumbnail.c Modified: kazehakase/trunk/ChangeLog =================================================================== --- kazehakase/trunk/ChangeLog 2007-04-14 15:05:15 UTC (rev 3185) +++ kazehakase/trunk/ChangeLog 2007-04-14 15:08:45 UTC (rev 3186) @@ -1,5 +1,12 @@ 2007-04-15 Kouhei Sutou <kou****@cozmi*****> + * src/kz-app.[ch] (kz_app_get): added. + + * src/kz-window.c, src/main.c, src/actions/kz-actions-popup.c, + src/actions/kz-actions.c, src/kz-notebook.c, + src/widget/kz-thumbnail.c, src/kazehakase.h: don't use kz_app + global variable. + * configure.ac: added LT_VERSION related info. 2007-04-14 Kouhei Sutou <kou****@cozmi*****> Modified: kazehakase/trunk/src/actions/kz-actions-popup.c =================================================================== --- kazehakase/trunk/src/actions/kz-actions-popup.c 2007-04-14 15:05:15 UTC (rev 3185) +++ kazehakase/trunk/src/actions/kz-actions-popup.c 2007-04-14 15:08:45 UTC (rev 3186) @@ -108,7 +108,7 @@ break; case NEW_WINDOW: { - GtkWidget *widget = kz_app_create_new_window(kz_app, uri); + GtkWidget *widget = KZ_CREATE_NEW_WINDOW(uri); gtk_widget_show(widget); break; } Modified: kazehakase/trunk/src/actions/kz-actions.c =================================================================== --- kazehakase/trunk/src/actions/kz-actions.c 2007-04-14 15:05:15 UTC (rev 3185) +++ kazehakase/trunk/src/actions/kz-actions.c 2007-04-14 15:08:45 UTC (rev 3186) @@ -125,7 +125,7 @@ g_return_if_fail(KZ_IS_WINDOW(kz)); - widget = kz_app_create_new_window(kz_app, NULL); + widget = KZ_CREATE_NEW_WINDOW(NULL); gtk_widget_show(widget); } @@ -1351,14 +1351,14 @@ static void act_save_session (GtkAction *action, KzWindow *kz) { - kz_app_save_session(kz_app); + KZ_SAVE_SESSION(); } static void act_restore_session (GtkAction *action, KzWindow *kz) { - kz_app_restore_session(kz_app); + KZ_RESTORE_SESSION(); } Modified: kazehakase/trunk/src/kazehakase.h =================================================================== --- kazehakase/trunk/src/kazehakase.h 2007-04-14 15:05:15 UTC (rev 3185) +++ kazehakase/trunk/src/kazehakase.h 2007-04-14 15:08:45 UTC (rev 3186) @@ -36,69 +36,76 @@ #define HISTORY_DIR G_DIR_SEPARATOR_S"."PACKAGE G_DIR_SEPARATOR_S"history"G_DIR_SEPARATOR_S -extern KzApp *kz_app; - #define KZ_CONF_GET(s, k, v, t) \ - kz_profile_get_value(kz_app_get_profile(kz_app), \ + kz_profile_get_value(kz_app_get_profile(kz_app_get()), \ s, k, &(v), sizeof(v), \ KZ_PROFILE_VALUE_TYPE_##t) #define KZ_CONF_SET(s, k, v, t) \ - kz_profile_set_value(kz_app_get_profile(kz_app), \ + kz_profile_set_value(kz_app_get_profile(kz_app_get()), \ s, k, &(v), sizeof(v), \ KZ_PROFILE_VALUE_TYPE_##t) #define KZ_CONF_GET_STR(s, k) \ - kz_profile_get_string(kz_app_get_profile(kz_app), s, k) + kz_profile_get_string(kz_app_get_profile(kz_app_get()), s, k) #define KZ_CONF_SET_STR(s, k, v) \ - kz_profile_set_value(kz_app_get_profile(kz_app), \ + kz_profile_set_value(kz_app_get_profile(kz_app_get()), \ s, k, \ (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) -#define KZ_GET_ROOT_BOOKMARK kz_app_get_root_bookmark(kz_app) -#define KZ_GET_CURRENT_SESSION kz_app_get_root_bookmark(kz_app)->current_session -#define KZ_GET_MENU_BOOKMARK kz_app_get_root_bookmark(kz_app)->menu -#define KZ_GET_SMART_BOOKMARK kz_app_get_root_bookmark(kz_app)->smarts -#define KZ_GET_BAR_BOOKMARK kz_app_get_root_bookmark(kz_app)->bookmark_bars -#define KZ_GET_CLIP_BOOKMARK kz_app_get_root_bookmark(kz_app)->clip -#define KZ_GET_SEARCH kz_app_get_search(kz_app) -#define KZ_GET_WINDOW_LIST kz_app_get_window_list(kz_app) -#define KZ_GET_MIGEMO kz_app_get_migemo(kz_app) +#define KZ_GET_UI_LEVEL kz_app_get_ui_level(kz_app_get()) +#define KZ_GET_GLOBAL_PROFILE kz_app_get_profile(kz_app_get()) +#define KZ_GET_PROXY kz_app_get_proxy(kz_app_get()) +#define KZ_GET_FAVICON kz_app_get_favicon(kz_app_get()) +#define KZ_GET_ROOT_BOOKMARK kz_app_get_root_bookmark(kz_app_get()) +#define KZ_GET_CURRENT_SESSION kz_app_get_root_bookmark(kz_app_get())->current_session +#define KZ_GET_MENU_BOOKMARK kz_app_get_root_bookmark(kz_app_get())->menu +#define KZ_GET_SMART_BOOKMARK kz_app_get_root_bookmark(kz_app_get())->smarts +#define KZ_GET_BAR_BOOKMARK kz_app_get_root_bookmark(kz_app_get())->bookmark_bars +#define KZ_GET_CLIP_BOOKMARK kz_app_get_root_bookmark(kz_app_get())->clip +#define KZ_GET_SEARCH kz_app_get_search(kz_app_get()) +#define KZ_GET_WINDOW_LIST kz_app_get_window_list(kz_app_get()) +#define KZ_GET_MIGEMO kz_app_get_migemo(kz_app_get()) -#define KZ_GET_USER_DIR kz_app_get_user_dir(kz_app) -#define KZ_GET_HISTORY_DIR kz_app_get_history_dir(kz_app) -#define KZ_GET_HISTORY_TIME_STAMP kz_app_get_history_time_stamp(kz_app) -#define KZ_GET_POPUP_DIR kz_app_get_popup_dir(kz_app) -#define KZ_GET_FAVICON_DIR kz_app_get_favicon_dir(kz_app) -#define KZ_GET_SMARTBOOKMARK_HISTORY_DIR kz_app_get_smartbookmark_history_dir(kz_app) -#define KZ_GET_FORM_DATA_DIR kz_app_get_form_data_dir(kz_app) -#define KZ_GET_CLIPS_DIR kz_app_get_clips_dir(kz_app) -#define KZ_GET_THUMBNAILS_DIR kz_app_get_thumbnails_dir(kz_app) +#define KZ_GET_USER_DIR kz_app_get_user_dir(kz_app_get()) +#define KZ_GET_HISTORY_DIR kz_app_get_history_dir(kz_app_get()) +#define KZ_GET_HISTORY_TIME_STAMP kz_app_get_history_time_stamp(kz_app_get()) +#define KZ_GET_POPUP_DIR kz_app_get_popup_dir(kz_app_get()) +#define KZ_GET_FAVICON_DIR kz_app_get_favicon_dir(kz_app_get()) +#define KZ_GET_SMARTBOOKMARK_HISTORY_DIR kz_app_get_smartbookmark_history_dir(kz_app_get()) +#define KZ_GET_FORM_DATA_DIR kz_app_get_form_data_dir(kz_app_get()) +#define KZ_GET_CLIPS_DIR kz_app_get_clips_dir(kz_app_get()) +#define KZ_GET_THUMBNAILS_DIR kz_app_get_thumbnails_dir(kz_app_get()) -#define KZ_GET_SYSTEM_DATA_DIR kz_app_get_system_data_dir(kz_app) -#define KZ_GET_SYSTEM_KZ_DATA_DIR kz_app_get_system_kz_data_dir(kz_app) -#define KZ_GET_SYSTEM_LIB_DIR kz_app_get_system_lib_dir(kz_app) -#define KZ_GET_SYSTEM_CONFIG_DIR kz_app_get_system_config_dir(kz_app) +#define KZ_GET_SYSTEM_DATA_DIR kz_app_get_system_data_dir(kz_app_get()) +#define KZ_GET_SYSTEM_KZ_DATA_DIR kz_app_get_system_kz_data_dir(kz_app_get()) +#define KZ_GET_SYSTEM_LIB_DIR kz_app_get_system_lib_dir(kz_app_get()) +#define KZ_GET_SYSTEM_CONFIG_DIR kz_app_get_system_config_dir(kz_app_get()) -#define KZ_GET_SYSTEM_ICONS_DIR kz_app_get_system_icons_dir(kz_app) -#define KZ_GET_SYSTEM_PIXMAPS_DIR kz_app_get_system_pixmaps_dir(kz_app) +#define KZ_GET_SYSTEM_ICONS_DIR kz_app_get_system_icons_dir(kz_app_get()) +#define KZ_GET_SYSTEM_PIXMAPS_DIR kz_app_get_system_pixmaps_dir(kz_app_get()) -#define KZ_GET_SYSTEM_EMBED_MODULE_DIR kz_app_get_system_embed_module_dir(kz_app) -#define KZ_GET_SYSTEM_SEARCH_MODULE_DIR kz_app_get_system_search_module_dir(kz_app) +#define KZ_GET_SYSTEM_EMBED_MODULE_DIR kz_app_get_system_embed_module_dir(kz_app_get()) +#define KZ_GET_SYSTEM_SEARCH_MODULE_DIR kz_app_get_system_search_module_dir(kz_app_get()) -#define KZ_GET_SYSTEM_EXT_DIR kz_app_get_system_ext_dir(kz_app) -#define KZ_GET_SYSTEM_RUBY_EXT_DIR kz_app_get_system_ruby_ext_dir(kz_app) -#define KZ_GET_SYSTEM_RUBY_EXT_DATA_DIR kz_app_get_system_ruby_ext_data_dir(kz_app) +#define KZ_GET_SYSTEM_EXT_DIR kz_app_get_system_ext_dir(kz_app_get()) +#define KZ_GET_SYSTEM_RUBY_EXT_DIR kz_app_get_system_ruby_ext_dir(kz_app_get()) +#define KZ_GET_SYSTEM_RUBY_EXT_DATA_DIR kz_app_get_system_ruby_ext_data_dir(kz_app_get()) -#define KZ_SET_SEARCH(engine_name) kz_app_set_search(kz_app, engine_name) +#define KZ_SET_SEARCH(engine_name) kz_app_set_search(kz_app_get(), engine_name) +#define KZ_CREATE_NEW_WINDOW(uri) \ + kz_app_create_new_window(kz_app_get(), uri) #define KZ_CREATE_THUMBNAIL(pixbuf, uri, mtime, size) \ - kz_app_create_thumbnail(kz_app, pixbuf, uri, mtime, size) + kz_app_create_thumbnail(kz_app_get(), pixbuf, uri, mtime, size) +#define KZ_SAVE_SESSION() kz_app_save_session(kz_app_get()) +#define KZ_RESTORE_SESSION() kz_app_restore_session(kz_app_get()) +#define KZ_FREEZE_SESSION() kz_app_freeze_session(kz_app_get()) +#define KZ_THAW_SESSION() kz_app_thaw_session(kz_app_get()) + +#define KZ_GET_WINDOW_FROM_TAB(tab) kz_app_get_window_from_tab(kz_app_get(), tab) + G_END_DECLS #endif /* __KAZEAKASE_H__ */ Modified: kazehakase/trunk/src/kz-app.c =================================================================== --- kazehakase/trunk/src/kz-app.c 2007-04-14 15:05:15 UTC (rev 3185) +++ kazehakase/trunk/src/kz-app.c 2007-04-14 15:08:45 UTC (rev 3186) @@ -137,8 +137,14 @@ static void connect_sm (KzApp *app); #endif /* HAVE_LIBSM */ -static KzApp *the_kzapp = NULL; +static KzApp *the_kz_app = NULL; +KzApp * +kz_app_get (void) +{ + return the_kz_app; +} + G_DEFINE_TYPE(KzApp, kz_app, G_TYPE_OBJECT) static gint kz_app_signals[LAST_SIGNAL] = {0}; @@ -195,7 +201,7 @@ { GObject *object; - if (!the_kzapp) + if (!the_kz_app) { GObjectClass *klass = G_OBJECT_CLASS(kz_app_parent_class); object = klass->constructor(type, n_props, props); @@ -205,11 +211,11 @@ connect_sm(KZ_APP(object)); #endif /* HAVE_LIBSM */ - the_kzapp = KZ_APP(object); + the_kz_app = KZ_APP(object); } else { - object = g_object_ref(G_OBJECT(the_kzapp)); + object = g_object_ref(G_OBJECT(the_kz_app)); } return object; } Modified: kazehakase/trunk/src/kz-app.h =================================================================== --- kazehakase/trunk/src/kz-app.h 2007-04-14 15:05:15 UTC (rev 3185) +++ kazehakase/trunk/src/kz-app.h 2007-04-14 15:08:45 UTC (rev 3186) @@ -62,6 +62,8 @@ KzApp *kz_app_new (gint argc, gchar **argv); +KzApp *kz_app_get (void); + const gchar *kz_app_get_user_dir (KzApp *app); const gchar *kz_app_get_history_dir (KzApp *app); const gchar *kz_app_get_history_time_stamp (KzApp *app); Modified: kazehakase/trunk/src/kz-notebook.c =================================================================== --- kazehakase/trunk/src/kz-notebook.c 2007-04-14 15:05:15 UTC (rev 3185) +++ kazehakase/trunk/src/kz-notebook.c 2007-04-14 15:08:45 UTC (rev 3186) @@ -256,7 +256,7 @@ if (!KZ_IS_TAB_LABEL(src_widget)) return; src_kztab = KZ_TAB_LABEL(src_widget); - src_kz = KZ_WINDOW(kz_app_get_window_from_tab(kz_app, GTK_WIDGET(src_kztab->kzembed))); + src_kz = KZ_WINDOW(KZ_GET_WINDOW_FROM_TAB(GTK_WIDGET(src_kztab->kzembed))); if (kz == src_kz) { gint n; Modified: kazehakase/trunk/src/kz-window.c =================================================================== --- kazehakase/trunk/src/kz-window.c 2007-04-14 15:05:15 UTC (rev 3185) +++ kazehakase/trunk/src/kz-window.c 2007-04-14 15:08:45 UTC (rev 3186) @@ -992,7 +992,7 @@ priv = KZ_WINDOW_GET_PRIVATE(kz); kzembed = KZ_EMBED(widget); - src_kz = KZ_WINDOW(kz_app_get_window_from_tab(kz_app, widget)); + src_kz = KZ_WINDOW(KZ_GET_WINDOW_FROM_TAB(widget)); if (!src_kz) return; src_priv = KZ_WINDOW_GET_PRIVATE(src_kz); @@ -1064,9 +1064,9 @@ kz_window_store_state(kz); - kz_app_freeze_session(kz_app); + KZ_FREEZE_SESSION(); kz_notebook_close_all_tab(KZ_NOTEBOOK(kz->notebook)); - kz_app_thaw_session(kz_app); + KZ_THAW_SESSION(); return FALSE; } Modified: kazehakase/trunk/src/main.c =================================================================== --- kazehakase/trunk/src/main.c 2007-04-14 15:05:15 UTC (rev 3185) +++ kazehakase/trunk/src/main.c 2007-04-14 15:08:45 UTC (rev 3186) @@ -35,8 +35,6 @@ #include "kz-actions-tab.h" #include "utils.h" -KzApp *kz_app = NULL; - static gchar** action_array; static gchar* geometry_string; static gboolean show_version; @@ -135,7 +133,7 @@ #warning This function has side effect! - if (!kz_app) return; + if (!kz_app_get()) return; list = KZ_GET_WINDOW_LIST; if (!list || !list->data || !KZ_IS_WINDOW(list->data)) @@ -153,7 +151,7 @@ kz = KZ_WINDOW(list->data); for(i = 1; i < argc; i++) { - gchar *uri = complement_scheme(argv[i]); + gchar *uri = kz_utils_complement_scheme(argv[i]); gdk_window_raise(GTK_WIDGET(kz)->window); kz_window_open_new_tab(kz, uri); @@ -425,6 +423,7 @@ gboolean retval; GError *error = NULL; gboolean restore = FALSE; + KzApp *kz_app; /* initialize */ #ifdef G_OS_WIN32 Modified: kazehakase/trunk/src/widget/kz-thumbnail.c =================================================================== --- kazehakase/trunk/src/widget/kz-thumbnail.c 2007-04-14 15:05:15 UTC (rev 3185) +++ kazehakase/trunk/src/widget/kz-thumbnail.c 2007-04-14 15:08:45 UTC (rev 3186) @@ -73,7 +73,7 @@ if (priv->uri) g_free(priv->uri); if (priv->handler_id) - g_signal_handler_disconnect(kz_app, priv->handler_id); + g_signal_handler_disconnect(kz_app_get(), priv->handler_id); priv->uri = NULL; priv->handler_id = 0; @@ -116,7 +116,7 @@ NULL); priv = KZ_THUMBNAIL_GET_PRIVATE(thumbnail); - priv->handler_id = g_signal_connect(kz_app, "thumbnail-created", + priv->handler_id = g_signal_connect(kz_app_get(), "thumbnail-created", G_CALLBACK(cb_thumbnail_created), thumbnail);