Commit 428bf455 authored by Ramiro Estrugo's avatar Ramiro Estrugo
Browse files

Add preference for filename fonts. Not wired up to anything yet.

* libnautilus-extensions/nautilus-global-preferences.c:
(global_preferences_create_dialog),
(global_preferences_register_for_ui):
* libnautilus-extensions/nautilus-global-preferences.h:

Add preference for filename fonts.  Not wired up to anything yet.

* nautilus-widgets/nautilus-preferences-item.c,
(preferences_item_construct),
(preferences_item_create_font_family),
(enum_radio_group_changed_callback),
(boolean_button_toggled_callback), (font_family_changed_callback):
* nautilus-widgets/nautilus-preferences-item.h:

Add UI support for choosing a font family via preferences.

* nautilus-widgets/nautilus-string-picker.c:
(nautilus_string_picker_initialize),
(nautilus_string_picker_destroy),
(nautilus_string_picker_set_string_list),
(nautilus_string_picker_get_text),
(nautilus_string_picker_set_text):
* nautilus-widgets/nautilus-string-picker.h:

Add methods to set/get the current text.  Keep track of the string
list ourselves so that we dont have to peek/poke into internal
stuff in the gtkcombo.
parent 7b4e5be3
......@@ -188,6 +188,12 @@ global_preferences_create_dialog (void)
NAUTILUS_PREFERENCES_EAZEL_TOOLBAR_ICONS,
NAUTILUS_PREFERENCE_ITEM_BOOLEAN);
nautilus_preferences_pane_add_group (NAUTILUS_PREFERENCES_PANE (appearance_pane), "Fonts");
nautilus_preferences_pane_add_item_to_nth_group (NAUTILUS_PREFERENCES_PANE (appearance_pane),
2,
NAUTILUS_PREFERENCES_DIRECTORY_VIEW_FONT_FAMILY,
NAUTILUS_PREFERENCE_ITEM_FONT_FAMILY);
/* all done */
return prefs_dialog;
......@@ -422,6 +428,12 @@ global_preferences_register_for_ui (void)
NAUTILUS_PREFERENCE_BOOLEAN,
(gconstpointer) FALSE);
/* Directory View */
nautilus_preferences_set_info (NAUTILUS_PREFERENCES_DIRECTORY_VIEW_FONT_FAMILY,
"Font familiy used to display file names",
NAUTILUS_PREFERENCE_STRING,
(gconstpointer) "helvetica");
/* toolbar icons */
nautilus_preferences_set_info (NAUTILUS_PREFERENCES_EAZEL_TOOLBAR_ICONS,
"Use Eazel's toolbar icons",
......
......@@ -58,6 +58,9 @@ BEGIN_GNOME_DECLS
/* Sidebar panels */
#define NAUTILUS_PREFERENCES_SIDEBAR_PANELS_NAMESPACE "/nautilus/sidebar-panels"
/* Directory view */
#define NAUTILUS_PREFERENCES_DIRECTORY_VIEW_FONT_FAMILY "/nautilus/directory-view/font_family"
/* themes */
#define NAUTILUS_PREFERENCES_EAZEL_TOOLBAR_ICONS "/nautilus/preferences/eazel_toolbar_icons"
#define NAUTILUS_PREFERENCES_ICON_THEME "/nautilus/preferences/icon_theme"
......
......@@ -28,7 +28,9 @@
#include <libnautilus-extensions/nautilus-gtk-macros.h>
#include <gtk/gtkcheckbutton.h>
#include <nautilus-widgets/nautilus-radio-button-group.h>
#include <nautilus-widgets/nautilus-string-picker.h>
/* Arguments */
enum
......@@ -78,11 +80,15 @@ static void preferences_item_create_enum (NautilusPreferencesItem
const NautilusPreference *prefrence);
static void preferences_item_create_boolean (NautilusPreferencesItem *item,
const NautilusPreference *prefrence);
static void preferences_item_create_font_family (NautilusPreferencesItem *item,
const NautilusPreference *prefrence);
static void enum_radio_group_changed_callback (GtkWidget *button_group,
GtkWidget *button,
gpointer user_data);
static void boolean_button_toggled_callback (GtkWidget *button_group,
gpointer user_data);
static void font_family_changed_callback (GtkWidget *string_picker,
gpointer user_data);
NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusPreferencesItem, nautilus_preferences_item, GTK_TYPE_VBOX)
......@@ -258,6 +264,10 @@ preferences_item_construct (NautilusPreferencesItem *item,
case NAUTILUS_PREFERENCE_ITEM_ENUM:
preferences_item_create_enum (item, preference);
break;
case NAUTILUS_PREFERENCE_ITEM_FONT_FAMILY:
preferences_item_create_font_family (item, preference);
break;
}
gtk_object_unref (GTK_OBJECT (preference));
......@@ -342,6 +352,56 @@ preferences_item_create_boolean (NautilusPreferencesItem *item,
(gpointer) item);
}
static void
preferences_item_create_font_family (NautilusPreferencesItem *item,
const NautilusPreference *preference)
{
char *description;
char *current_value;
NautilusStringList *font_list;
g_assert (item != NULL);
g_assert (preference != NULL);
g_assert (item->details->preference_name != NULL);
description = nautilus_preference_get_description (preference);
g_assert (description != NULL);
item->details->child = nautilus_string_picker_new ();
nautilus_string_picker_set_title_label (NAUTILUS_STRING_PICKER (item->details->child), description);
g_free (description);
/* FIXME bugzilla.eazel.com XXX: Need to query system for available fonts */
font_list = nautilus_string_list_new ();
nautilus_string_list_insert (font_list, "helvetica");
nautilus_string_list_insert (font_list, "times");
nautilus_string_list_insert (font_list, "courier");
nautilus_string_list_insert (font_list, "lucida");
nautilus_string_list_insert (font_list, "fixed");
nautilus_string_picker_set_string_list (NAUTILUS_STRING_PICKER (item->details->child), font_list);
current_value = nautilus_preferences_get (item->details->preference_name, "helvetica");
g_assert (current_value != NULL);
g_assert (nautilus_string_list_contains (font_list, current_value));
nautilus_string_picker_set_text (NAUTILUS_STRING_PICKER (item->details->child), current_value);
g_free (current_value);
nautilus_string_list_free (font_list);
gtk_signal_connect (GTK_OBJECT (item->details->child),
"changed",
GTK_SIGNAL_FUNC (font_family_changed_callback),
(gpointer) item);
}
/* NautilusPreferencesItem public methods */
GtkWidget *
nautilus_preferences_item_new (const gchar *preference_name,
......@@ -364,11 +424,15 @@ nautilus_preferences_item_new (const gchar *preference_name,
static void
enum_radio_group_changed_callback (GtkWidget *buttons, GtkWidget * button, gpointer user_data)
{
NautilusPreferencesItem *item = (NautilusPreferencesItem *) user_data;
NautilusPreferencesItem *item;
const NautilusPreference *preference;
gint i;
g_assert (item != NULL);
g_assert (user_data != NULL);
g_assert (NAUTILUS_IS_PREFERENCES_ITEM (user_data));
item = NAUTILUS_PREFERENCES_ITEM (user_data);
g_assert (item->details->preference_name != NULL);
preference = nautilus_preferences_get_preference (item->details->preference_name);
......@@ -382,12 +446,39 @@ enum_radio_group_changed_callback (GtkWidget *buttons, GtkWidget * button, gpoin
static void
boolean_button_toggled_callback (GtkWidget *button, gpointer user_data)
{
NautilusPreferencesItem *item = (NautilusPreferencesItem *) user_data;
NautilusPreferencesItem *item;
gboolean active_state;
g_assert (item != NULL);
g_assert (user_data != NULL);
g_assert (NAUTILUS_IS_PREFERENCES_ITEM (user_data));
item = NAUTILUS_PREFERENCES_ITEM (user_data);
active_state = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
nautilus_preferences_set_boolean (item->details->preference_name, active_state);
}
static void
font_family_changed_callback (GtkWidget *button, gpointer user_data)
{
NautilusPreferencesItem *item;
char *text;
g_assert (user_data != NULL);
g_assert (NAUTILUS_IS_PREFERENCES_ITEM (user_data));
item = NAUTILUS_PREFERENCES_ITEM (user_data);
g_assert (item->details->child != NULL);
g_assert (NAUTILUS_IS_STRING_PICKER (item->details->child));
text = nautilus_string_picker_get_text (NAUTILUS_STRING_PICKER (item->details->child));
if (text != NULL)
{
nautilus_preferences_set (item->details->preference_name, text);
g_free (text);
}
}
......@@ -37,7 +37,7 @@ BEGIN_GNOME_DECLS
#define NAUTILUS_IS_PREFERENCES_ITEM(obj) (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_PREFERENCES_ITEM))
#define NAUTILUS_IS_PREFERENCES_ITEM_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_PREFERENCES_ITEM))
typedef struct _NautilusPreferencesItem NautilusPreferencesItem;
typedef struct _NautilusPreferencesItem NautilusPreferencesItem;
typedef struct _NautilusPreferencesItemClass NautilusPreferencesItemClass;
typedef struct _NautilusPreferencesItemDetails NautilusPreferencesItemDetails;
......@@ -65,7 +65,8 @@ struct _NautilusPreferencesItemClass
typedef enum
{
NAUTILUS_PREFERENCE_ITEM_BOOLEAN,
NAUTILUS_PREFERENCE_ITEM_ENUM
NAUTILUS_PREFERENCE_ITEM_ENUM,
NAUTILUS_PREFERENCE_ITEM_FONT_FAMILY
} NautilusPreferencesItemType;
GtkType nautilus_preferences_item_get_type (void);
......
......@@ -45,25 +45,24 @@ typedef enum
struct _NautilusStringPickerDetail
{
GtkWidget *title_label;
GtkWidget *combo_box;
GtkWidget *title_label;
GtkWidget *combo_box;
NautilusStringList *string_list;
};
/* NautilusStringPickerClass methods */
static void nautilus_string_picker_initialize_class (NautilusStringPickerClass *klass);
static void nautilus_string_picker_initialize (NautilusStringPicker *string_picker);
static void nautilus_string_picker_initialize_class (NautilusStringPickerClass *klass);
static void nautilus_string_picker_initialize (NautilusStringPicker *string_picker);
/* GtkObjectClass methods */
static void nautilus_string_picker_destroy (GtkObject *object);
static void nautilus_string_picker_destroy (GtkObject *object);
/* Private stuff */
static GtkEntry * string_picker_get_entry_widget (NautilusStringPicker *string_picker);
static GtkEntry *string_picker_get_entry_widget (NautilusStringPicker *string_picker);
/* Editable (entry) callbacks */
static void entry_changed_callback (GtkWidget *entry,
gpointer user_data);
static void entry_changed_callback (GtkWidget *entry,
gpointer user_data);
NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusStringPicker, nautilus_string_picker, GTK_TYPE_HBOX)
......@@ -107,6 +106,8 @@ nautilus_string_picker_initialize (NautilusStringPicker *string_picker)
gtk_box_set_homogeneous (GTK_BOX (string_picker), FALSE);
gtk_box_set_spacing (GTK_BOX (string_picker), STRING_PICKER_SPACING);
string_picker->detail->string_list = NULL;
string_picker->detail->title_label = gtk_label_new ("Title Label:");
string_picker->detail->combo_box = gtk_combo_new ();
......@@ -146,6 +147,10 @@ nautilus_string_picker_destroy(GtkObject* object)
string_picker = NAUTILUS_STRING_PICKER (object);
if (string_picker->detail->string_list != NULL) {
nautilus_string_list_free (string_picker->detail->string_list);
}
g_free (string_picker->detail);
/* Chain */
......@@ -216,7 +221,9 @@ nautilus_string_picker_set_string_list (NautilusStringPicker *string_picker,
g_return_if_fail (string_picker != NULL);
g_return_if_fail (NAUTILUS_IS_STRING_PICKER (string_picker));
strings = nautilus_string_list_as_g_list (string_list);
string_picker->detail->string_list = nautilus_string_list_new_from_string_list (string_list);
strings = nautilus_string_list_as_g_list (string_picker->detail->string_list);
gtk_combo_set_popdown_strings (GTK_COMBO (string_picker->detail->combo_box), strings);
......@@ -262,3 +269,16 @@ nautilus_string_picker_get_text (NautilusStringPicker *string_picker)
return g_strdup (entry_text);
}
void
nautilus_string_picker_set_text (NautilusStringPicker *string_picker,
const char *text)
{
g_return_if_fail (string_picker != NULL);
g_return_if_fail (NAUTILUS_IS_STRING_PICKER (string_picker));
g_return_if_fail (string_picker->detail->string_list != NULL);
g_return_if_fail (nautilus_string_list_contains (string_picker->detail->string_list, text));
gtk_entry_set_text (string_picker_get_entry_widget (string_picker), text);
}
......@@ -72,6 +72,8 @@ void nautilus_string_picker_set_string_list (NautilusStringPicker *str
void nautilus_string_picker_set_title_label (NautilusStringPicker *string_picker,
const char *title_label);
char * nautilus_string_picker_get_text (NautilusStringPicker *string_picker);
void nautilus_string_picker_set_text (NautilusStringPicker *string_picker,
const char *text);
BEGIN_GNOME_DECLS
......
......@@ -188,6 +188,12 @@ global_preferences_create_dialog (void)
NAUTILUS_PREFERENCES_EAZEL_TOOLBAR_ICONS,
NAUTILUS_PREFERENCE_ITEM_BOOLEAN);
nautilus_preferences_pane_add_group (NAUTILUS_PREFERENCES_PANE (appearance_pane), "Fonts");
nautilus_preferences_pane_add_item_to_nth_group (NAUTILUS_PREFERENCES_PANE (appearance_pane),
2,
NAUTILUS_PREFERENCES_DIRECTORY_VIEW_FONT_FAMILY,
NAUTILUS_PREFERENCE_ITEM_FONT_FAMILY);
/* all done */
return prefs_dialog;
......@@ -422,6 +428,12 @@ global_preferences_register_for_ui (void)
NAUTILUS_PREFERENCE_BOOLEAN,
(gconstpointer) FALSE);
/* Directory View */
nautilus_preferences_set_info (NAUTILUS_PREFERENCES_DIRECTORY_VIEW_FONT_FAMILY,
"Font familiy used to display file names",
NAUTILUS_PREFERENCE_STRING,
(gconstpointer) "helvetica");
/* toolbar icons */
nautilus_preferences_set_info (NAUTILUS_PREFERENCES_EAZEL_TOOLBAR_ICONS,
"Use Eazel's toolbar icons",
......
......@@ -58,6 +58,9 @@ BEGIN_GNOME_DECLS
/* Sidebar panels */
#define NAUTILUS_PREFERENCES_SIDEBAR_PANELS_NAMESPACE "/nautilus/sidebar-panels"
/* Directory view */
#define NAUTILUS_PREFERENCES_DIRECTORY_VIEW_FONT_FAMILY "/nautilus/directory-view/font_family"
/* themes */
#define NAUTILUS_PREFERENCES_EAZEL_TOOLBAR_ICONS "/nautilus/preferences/eazel_toolbar_icons"
#define NAUTILUS_PREFERENCES_ICON_THEME "/nautilus/preferences/icon_theme"
......
......@@ -28,7 +28,9 @@
#include <libnautilus-extensions/nautilus-gtk-macros.h>
#include <gtk/gtkcheckbutton.h>
#include <nautilus-widgets/nautilus-radio-button-group.h>
#include <nautilus-widgets/nautilus-string-picker.h>
/* Arguments */
enum
......@@ -78,11 +80,15 @@ static void preferences_item_create_enum (NautilusPreferencesItem
const NautilusPreference *prefrence);
static void preferences_item_create_boolean (NautilusPreferencesItem *item,
const NautilusPreference *prefrence);
static void preferences_item_create_font_family (NautilusPreferencesItem *item,
const NautilusPreference *prefrence);
static void enum_radio_group_changed_callback (GtkWidget *button_group,
GtkWidget *button,
gpointer user_data);
static void boolean_button_toggled_callback (GtkWidget *button_group,
gpointer user_data);
static void font_family_changed_callback (GtkWidget *string_picker,
gpointer user_data);
NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusPreferencesItem, nautilus_preferences_item, GTK_TYPE_VBOX)
......@@ -258,6 +264,10 @@ preferences_item_construct (NautilusPreferencesItem *item,
case NAUTILUS_PREFERENCE_ITEM_ENUM:
preferences_item_create_enum (item, preference);
break;
case NAUTILUS_PREFERENCE_ITEM_FONT_FAMILY:
preferences_item_create_font_family (item, preference);
break;
}
gtk_object_unref (GTK_OBJECT (preference));
......@@ -342,6 +352,56 @@ preferences_item_create_boolean (NautilusPreferencesItem *item,
(gpointer) item);
}
static void
preferences_item_create_font_family (NautilusPreferencesItem *item,
const NautilusPreference *preference)
{
char *description;
char *current_value;
NautilusStringList *font_list;
g_assert (item != NULL);
g_assert (preference != NULL);
g_assert (item->details->preference_name != NULL);
description = nautilus_preference_get_description (preference);
g_assert (description != NULL);
item->details->child = nautilus_string_picker_new ();
nautilus_string_picker_set_title_label (NAUTILUS_STRING_PICKER (item->details->child), description);
g_free (description);
/* FIXME bugzilla.eazel.com XXX: Need to query system for available fonts */
font_list = nautilus_string_list_new ();
nautilus_string_list_insert (font_list, "helvetica");
nautilus_string_list_insert (font_list, "times");
nautilus_string_list_insert (font_list, "courier");
nautilus_string_list_insert (font_list, "lucida");
nautilus_string_list_insert (font_list, "fixed");
nautilus_string_picker_set_string_list (NAUTILUS_STRING_PICKER (item->details->child), font_list);
current_value = nautilus_preferences_get (item->details->preference_name, "helvetica");
g_assert (current_value != NULL);
g_assert (nautilus_string_list_contains (font_list, current_value));
nautilus_string_picker_set_text (NAUTILUS_STRING_PICKER (item->details->child), current_value);
g_free (current_value);
nautilus_string_list_free (font_list);
gtk_signal_connect (GTK_OBJECT (item->details->child),
"changed",
GTK_SIGNAL_FUNC (font_family_changed_callback),
(gpointer) item);
}
/* NautilusPreferencesItem public methods */
GtkWidget *
nautilus_preferences_item_new (const gchar *preference_name,
......@@ -364,11 +424,15 @@ nautilus_preferences_item_new (const gchar *preference_name,
static void
enum_radio_group_changed_callback (GtkWidget *buttons, GtkWidget * button, gpointer user_data)
{
NautilusPreferencesItem *item = (NautilusPreferencesItem *) user_data;
NautilusPreferencesItem *item;
const NautilusPreference *preference;
gint i;
g_assert (item != NULL);
g_assert (user_data != NULL);
g_assert (NAUTILUS_IS_PREFERENCES_ITEM (user_data));
item = NAUTILUS_PREFERENCES_ITEM (user_data);
g_assert (item->details->preference_name != NULL);
preference = nautilus_preferences_get_preference (item->details->preference_name);
......@@ -382,12 +446,39 @@ enum_radio_group_changed_callback (GtkWidget *buttons, GtkWidget * button, gpoin
static void
boolean_button_toggled_callback (GtkWidget *button, gpointer user_data)
{
NautilusPreferencesItem *item = (NautilusPreferencesItem *) user_data;
NautilusPreferencesItem *item;
gboolean active_state;
g_assert (item != NULL);
g_assert (user_data != NULL);
g_assert (NAUTILUS_IS_PREFERENCES_ITEM (user_data));
item = NAUTILUS_PREFERENCES_ITEM (user_data);
active_state = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
nautilus_preferences_set_boolean (item->details->preference_name, active_state);
}
static void
font_family_changed_callback (GtkWidget *button, gpointer user_data)
{
NautilusPreferencesItem *item;
char *text;
g_assert (user_data != NULL);
g_assert (NAUTILUS_IS_PREFERENCES_ITEM (user_data));
item = NAUTILUS_PREFERENCES_ITEM (user_data);
g_assert (item->details->child != NULL);
g_assert (NAUTILUS_IS_STRING_PICKER (item->details->child));
text = nautilus_string_picker_get_text (NAUTILUS_STRING_PICKER (item->details->child));
if (text != NULL)
{
nautilus_preferences_set (item->details->preference_name, text);
g_free (text);
}
}
......@@ -37,7 +37,7 @@ BEGIN_GNOME_DECLS
#define NAUTILUS_IS_PREFERENCES_ITEM(obj) (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_PREFERENCES_ITEM))
#define NAUTILUS_IS_PREFERENCES_ITEM_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_PREFERENCES_ITEM))
typedef struct _NautilusPreferencesItem NautilusPreferencesItem;
typedef struct _NautilusPreferencesItem NautilusPreferencesItem;
typedef struct _NautilusPreferencesItemClass NautilusPreferencesItemClass;
typedef struct _NautilusPreferencesItemDetails NautilusPreferencesItemDetails;
......@@ -65,7 +65,8 @@ struct _NautilusPreferencesItemClass
typedef enum
{
NAUTILUS_PREFERENCE_ITEM_BOOLEAN,
NAUTILUS_PREFERENCE_ITEM_ENUM
NAUTILUS_PREFERENCE_ITEM_ENUM,
NAUTILUS_PREFERENCE_ITEM_FONT_FAMILY
} NautilusPreferencesItemType;
GtkType nautilus_preferences_item_get_type (void);
......
......@@ -45,25 +45,24 @@ typedef enum
struct _NautilusStringPickerDetail
{
GtkWidget *title_label;
GtkWidget *combo_box;
GtkWidget *title_label;
GtkWidget *combo_box;
NautilusStringList *string_list;
};
/* NautilusStringPickerClass methods */
static void nautilus_string_picker_initialize_class (NautilusStringPickerClass *klass);
static void nautilus_string_picker_initialize (NautilusStringPicker *string_picker);
static void nautilus_string_picker_initialize_class (NautilusStringPickerClass *klass);
static void nautilus_string_picker_initialize (NautilusStringPicker *string_picker);
/* GtkObjectClass methods */
static void nautilus_string_picker_destroy (GtkObject *object);
static void nautilus_string_picker_destroy (GtkObject *object);
/* Private stuff */
static GtkEntry * string_picker_get_entry_widget (NautilusStringPicker *string_picker);
static GtkEntry *string_picker_get_entry_widget (NautilusStringPicker *string_picker);
/* Editable (entry) callbacks */
static void entry_changed_callback (GtkWidget *entry,
gpointer user_data);
static void entry_changed_callback (GtkWidget *entry,
gpointer user_data);
NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusStringPicker, nautilus_string_picker, GTK_TYPE_HBOX)
......@@ -107,6 +106,8 @@ nautilus_string_picker_initialize (NautilusStringPicker *string_picker)
gtk_box_set_homogeneous (GTK_BOX (string_picker), FALSE);
gtk_box_set_spacing (GTK_BOX (string_picker), STRING_PICKER_SPACING);
string_picker->detail->string_list = NULL;
string_picker->detail->title_label = gtk_label_new ("Title Label:");
string_picker->detail->combo_box = gtk_combo_new ();
......@@ -146,6 +147,10 @@ nautilus_string_picker_destroy(GtkObject* object)
string_picker = NAUTILUS_STRING_PICKER (object);
if (string_picker->detail->string_list != NULL) {
nautilus_string_list_free (string_picker->detail->string_list);
}
g_free (string_picker->detail);
/* Chain */
......@@ -216,7 +221,9 @@ nautilus_string_picker_set_string_list (NautilusStringPicker *string_picker,
g_return_if_fail (string_picker != NULL);
g_return_if_fail (NAUTILUS_IS_STRING_PICKER (string_picker));
strings = nautilus_string_list_as_g_list (string_list);
string_picker->detail->string_list = nautilus_string_list_new_from_string_list (string_list);
strings = nautilus_string_list_as_g_list (string_picker->detail->string_list);
gtk_combo_set_popdown_strings (GTK_COMBO (string_picker->detail->combo_box), strings);
......@@ -262,3 +269,16 @@ nautilus_string_picker_get_text (NautilusStringPicker *string_picker)
return g_strdup (entry_text);
}
void
nautilus_string_picker_set_text (NautilusStringPicker *string_picker,
const char *text)
{
g_return_if_fail (string_picker != NULL);
g_return_if_fail (NAUTILUS_IS_STRING_PICKER (string_picker));
g_return_if_fail (string_picker->detail->string_list != NULL);
g_return_if_fail (nautilus_string_list_contains (string_picker->detail->string_list, text));
gtk_entry_set_text (string_picker_get_entry_widget (string_picker), text);
}
......@@ -72,6 +72,8 @@ void nautilus_string_picker_set_string_list (NautilusStringPicker *str
void nautilus_string_picker_set_title_label (NautilusStringPicker *string_picker,
const char *title_label);
char * nautilus_string_picker_get_text (NautilusStringPicker *string_picker);
void nautilus_string_picker_set_text (NautilusStringPicker *string_picker,
const char *text);
BEGIN_GNOME_DECLS
......
......@@ -28,7 +28,9 @@
#include <libnautilus-extensions/nautilus-gtk-macros.h>
#include <gtk/gtkcheckbutton.h>
#include <nautilus-widgets/nautilus-radio-button-group.h>
#include <nautilus-widgets/nautilus-string-picker.h>