Implement sokoke_key_file_get_string_list_default

This commit is contained in:
Dale Whittaker 2009-04-25 15:57:00 +02:00 committed by Christian Dywan
parent c31d9936d9
commit b7f684b345
2 changed files with 95 additions and 65 deletions

View file

@ -1,5 +1,6 @@
/* /*
Copyright (C) 2007-2009 Christian Dywan <christian@twotoasts.de> Copyright (C) 2007-2009 Christian Dywan <christian@twotoasts.de>
Copyright (C) 2009 Dale Whittaker <dayul@users.sf.net>
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public 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); 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 gboolean
sokoke_key_file_save_to_file (GKeyFile* key_file, sokoke_key_file_save_to_file (GKeyFile* key_file,
const gchar* filename, const gchar* filename,

View file

@ -1,5 +1,6 @@
/* /*
Copyright (C) 2007-2008 Christian Dywan <christian@twotoasts.de> Copyright (C) 2007-2008 Christian Dywan <christian@twotoasts.de>
Copyright (C) 2009 Dale Whittaker <dayul@users.sf.net>
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public modify it under the terms of the GNU Lesser General Public
@ -19,29 +20,29 @@
#include <JavaScriptCore/JavaScript.h> #include <JavaScriptCore/JavaScript.h>
gchar* gchar*
sokoke_js_script_eval (JSContextRef js_context, sokoke_js_script_eval (JSContextRef js_context,
const gchar* script, const gchar* script,
gchar** exception); gchar** exception);
/* Many themes need this hack for small toolbars to work */ /* Many themes need this hack for small toolbars to work */
#define GTK_ICON_SIZE_SMALL_TOOLBAR GTK_ICON_SIZE_BUTTON #define GTK_ICON_SIZE_SMALL_TOOLBAR GTK_ICON_SIZE_BUTTON
gboolean gboolean
sokoke_show_uri (GdkScreen* screen, sokoke_show_uri (GdkScreen* screen,
const gchar* uri, const gchar* uri,
guint32 timestamp, guint32 timestamp,
GError** error); GError** error);
gboolean gboolean
sokoke_spawn_program (const gchar* command, sokoke_spawn_program (const gchar* command,
const gchar* argument); const gchar* argument);
gchar* sokoke_search_uri (const gchar* uri, gchar* sokoke_search_uri (const gchar* uri,
const gchar* keywords); const gchar* keywords);
gchar* gchar*
sokoke_magic_uri (const gchar* uri, sokoke_magic_uri (const gchar* uri,
KatzeArray* search_engines); KatzeArray* search_engines);
typedef enum { typedef enum {
SOKOKE_MENU_POSITION_CURSOR = 0, SOKOKE_MENU_POSITION_CURSOR = 0,
@ -50,97 +51,106 @@ typedef enum {
} SokokeMenuPos; } SokokeMenuPos;
void void
sokoke_combo_box_add_strings (GtkComboBox* combobox, sokoke_combo_box_add_strings (GtkComboBox* combobox,
const gchar* label_first, const gchar* label_first,
...); ...);
void void
sokoke_widget_set_visible (GtkWidget* widget, sokoke_widget_set_visible (GtkWidget* widget,
gboolean visible); gboolean visible);
void void
sokoke_container_show_children (GtkContainer* container); sokoke_container_show_children (GtkContainer* container);
void void
sokoke_widget_popup (GtkWidget* widget, sokoke_widget_popup (GtkWidget* widget,
GtkMenu* menu, GtkMenu* menu,
GdkEventButton* event, GdkEventButton* event,
SokokeMenuPos pos); SokokeMenuPos pos);
GtkWidget* GtkWidget*
sokoke_xfce_header_new (const gchar* icon, sokoke_xfce_header_new (const gchar* icon,
const gchar* title); const gchar* title);
GtkWidget* GtkWidget*
sokoke_superuser_warning_new (void); sokoke_superuser_warning_new (void);
GtkWidget* GtkWidget*
sokoke_hig_frame_new (const gchar* title); sokoke_hig_frame_new (const gchar* title);
void void
sokoke_widget_set_pango_font_style (GtkWidget* widget, sokoke_widget_set_pango_font_style (GtkWidget* widget,
PangoStyle style); PangoStyle style);
void void
sokoke_entry_set_default_text (GtkEntry* entry, sokoke_entry_set_default_text (GtkEntry* entry,
const gchar* default_text); const gchar* default_text);
gchar* gchar*
sokoke_key_file_get_string_default (GKeyFile* key_file, sokoke_key_file_get_string_default (GKeyFile* key_file,
const gchar* group, const gchar* group,
const gchar* key, const gchar* key,
const gchar* default_value, const gchar* default_value,
GError** error); GError** error);
gint gint
sokoke_key_file_get_integer_default (GKeyFile* key_file, sokoke_key_file_get_integer_default (GKeyFile* key_file,
const gchar* group, const gchar* group,
const gchar* key, const gchar* key,
const gint default_value, const gint default_value,
GError** error); GError** error);
gdouble gdouble
sokoke_key_file_get_double_default (GKeyFile* key_file, sokoke_key_file_get_double_default (GKeyFile* key_file,
const gchar* group, const gchar* group,
const gchar* key, const gchar* key,
gdouble default_value, gdouble default_value,
GError** error); GError** error);
gboolean gboolean
sokoke_key_file_get_boolean_default (GKeyFile* key_file, sokoke_key_file_get_boolean_default (GKeyFile* key_file,
const gchar* group, const gchar* group,
const gchar* key, const gchar* key,
gboolean default_value, gboolean default_value,
GError** error); 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 gboolean
sokoke_key_file_save_to_file (GKeyFile* key_file, sokoke_key_file_save_to_file (GKeyFile* key_file,
const gchar* filename, const gchar* filename,
GError** error); GError** error);
void void
sokoke_widget_get_text_size (GtkWidget* widget, sokoke_widget_get_text_size (GtkWidget* widget,
const gchar* text, const gchar* text,
gint* width, gint* width,
gint* height); gint* height);
GtkWidget* GtkWidget*
sokoke_action_create_popup_menu_item (GtkAction* action); sokoke_action_create_popup_menu_item (GtkAction* action);
GtkWidget* GtkWidget*
sokoke_image_menu_item_new_ellipsized (const gchar* label); sokoke_image_menu_item_new_ellipsized (const gchar* label);
gint64 gint64
sokoke_time_t_to_julian (const time_t* timestamp); sokoke_time_t_to_julian (const time_t* timestamp);
void void
sokoke_register_stock_items (void); sokoke_register_stock_items (void);
const gchar* const gchar*
sokoke_set_config_dir (const gchar* new_config_dir); sokoke_set_config_dir (const gchar* new_config_dir);
gboolean gboolean
sokoke_remove_path (const gchar* path, sokoke_remove_path (const gchar* path,
gboolean ignore_errors); gboolean ignore_errors);
#endif /* !__SOKOKE_H__ */ #endif /* !__SOKOKE_H__ */