diff --git a/midori/sokoke.c b/midori/sokoke.c index a6bb4c1e..ad5c2732 100644 --- a/midori/sokoke.c +++ b/midori/sokoke.c @@ -1,5 +1,6 @@ /* Copyright (C) 2007-2009 Christian Dywan + Copyright (C) 2009 Dale Whittaker This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -675,6 +676,25 @@ sokoke_key_file_get_boolean_default (GKeyFile* key_file, return g_key_file_get_boolean (key_file, group, key, error); } +gchar** +sokoke_key_file_get_string_list_default (GKeyFile* key_file, + const gchar* group, + const gchar* key, + gsize* length, + gchar** default_value, + gsize* default_length, + GError* error) +{ + gchar** value = g_key_file_get_string_list (key_file, group, key, length, NULL); + if (!value) + { + value = g_strdupv (default_value); + if (length) + *length = *default_length; + } + return value; +} + gboolean sokoke_key_file_save_to_file (GKeyFile* key_file, const gchar* filename, diff --git a/midori/sokoke.h b/midori/sokoke.h index 5a685e02..61d80c3c 100644 --- a/midori/sokoke.h +++ b/midori/sokoke.h @@ -1,5 +1,6 @@ /* Copyright (C) 2007-2008 Christian Dywan + Copyright (C) 2009 Dale Whittaker This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -19,29 +20,29 @@ #include gchar* -sokoke_js_script_eval (JSContextRef js_context, - const gchar* script, - gchar** exception); +sokoke_js_script_eval (JSContextRef js_context, + const gchar* script, + gchar** exception); /* Many themes need this hack for small toolbars to work */ #define GTK_ICON_SIZE_SMALL_TOOLBAR GTK_ICON_SIZE_BUTTON gboolean -sokoke_show_uri (GdkScreen* screen, - const gchar* uri, - guint32 timestamp, - GError** error); +sokoke_show_uri (GdkScreen* screen, + const gchar* uri, + guint32 timestamp, + GError** error); gboolean -sokoke_spawn_program (const gchar* command, - const gchar* argument); +sokoke_spawn_program (const gchar* command, + const gchar* argument); -gchar* sokoke_search_uri (const gchar* uri, - const gchar* keywords); +gchar* sokoke_search_uri (const gchar* uri, + const gchar* keywords); gchar* -sokoke_magic_uri (const gchar* uri, - KatzeArray* search_engines); +sokoke_magic_uri (const gchar* uri, + KatzeArray* search_engines); typedef enum { SOKOKE_MENU_POSITION_CURSOR = 0, @@ -50,97 +51,106 @@ typedef enum { } SokokeMenuPos; void -sokoke_combo_box_add_strings (GtkComboBox* combobox, - const gchar* label_first, - ...); +sokoke_combo_box_add_strings (GtkComboBox* combobox, + const gchar* label_first, + ...); void -sokoke_widget_set_visible (GtkWidget* widget, - gboolean visible); +sokoke_widget_set_visible (GtkWidget* widget, + gboolean visible); void -sokoke_container_show_children (GtkContainer* container); +sokoke_container_show_children (GtkContainer* container); void -sokoke_widget_popup (GtkWidget* widget, - GtkMenu* menu, - GdkEventButton* event, - SokokeMenuPos pos); +sokoke_widget_popup (GtkWidget* widget, + GtkMenu* menu, + GdkEventButton* event, + SokokeMenuPos pos); GtkWidget* -sokoke_xfce_header_new (const gchar* icon, - const gchar* title); +sokoke_xfce_header_new (const gchar* icon, + const gchar* title); GtkWidget* -sokoke_superuser_warning_new (void); +sokoke_superuser_warning_new (void); GtkWidget* -sokoke_hig_frame_new (const gchar* title); +sokoke_hig_frame_new (const gchar* title); void -sokoke_widget_set_pango_font_style (GtkWidget* widget, - PangoStyle style); +sokoke_widget_set_pango_font_style (GtkWidget* widget, + PangoStyle style); void -sokoke_entry_set_default_text (GtkEntry* entry, - const gchar* default_text); +sokoke_entry_set_default_text (GtkEntry* entry, + const gchar* default_text); gchar* -sokoke_key_file_get_string_default (GKeyFile* key_file, - const gchar* group, - const gchar* key, - const gchar* default_value, - GError** error); +sokoke_key_file_get_string_default (GKeyFile* key_file, + const gchar* group, + const gchar* key, + const gchar* default_value, + GError** error); gint -sokoke_key_file_get_integer_default (GKeyFile* key_file, - const gchar* group, - const gchar* key, - const gint default_value, - GError** error); +sokoke_key_file_get_integer_default (GKeyFile* key_file, + const gchar* group, + const gchar* key, + const gint default_value, + GError** error); gdouble -sokoke_key_file_get_double_default (GKeyFile* key_file, - const gchar* group, - const gchar* key, - gdouble default_value, - GError** error); +sokoke_key_file_get_double_default (GKeyFile* key_file, + const gchar* group, + const gchar* key, + gdouble default_value, + GError** error); gboolean -sokoke_key_file_get_boolean_default (GKeyFile* key_file, - const gchar* group, - const gchar* key, - gboolean default_value, - GError** error); +sokoke_key_file_get_boolean_default (GKeyFile* key_file, + const gchar* group, + const gchar* key, + gboolean default_value, + GError** error); + +gchar** +sokoke_key_file_get_string_list_default (GKeyFile* key_file, + const gchar* group, + const gchar* key, + gsize* length, + gchar** default_value, + gsize* default_length, + GError* error); gboolean -sokoke_key_file_save_to_file (GKeyFile* key_file, - const gchar* filename, - GError** error); +sokoke_key_file_save_to_file (GKeyFile* key_file, + const gchar* filename, + GError** error); void -sokoke_widget_get_text_size (GtkWidget* widget, - const gchar* text, - gint* width, - gint* height); +sokoke_widget_get_text_size (GtkWidget* widget, + const gchar* text, + gint* width, + gint* height); GtkWidget* -sokoke_action_create_popup_menu_item (GtkAction* action); +sokoke_action_create_popup_menu_item (GtkAction* action); GtkWidget* -sokoke_image_menu_item_new_ellipsized (const gchar* label); +sokoke_image_menu_item_new_ellipsized (const gchar* label); gint64 -sokoke_time_t_to_julian (const time_t* timestamp); +sokoke_time_t_to_julian (const time_t* timestamp); void -sokoke_register_stock_items (void); +sokoke_register_stock_items (void); const gchar* -sokoke_set_config_dir (const gchar* new_config_dir); +sokoke_set_config_dir (const gchar* new_config_dir); gboolean -sokoke_remove_path (const gchar* path, - gboolean ignore_errors); +sokoke_remove_path (const gchar* path, + gboolean ignore_errors); #endif /* !__SOKOKE_H__ */