rhythmbox r5958 - in trunk: . plugins/audioscrobbler widgets
- From: mccann svn gnome org
- To: svn-commits-list gnome org
- Subject: rhythmbox r5958 - in trunk: . plugins/audioscrobbler widgets
- Date: Wed, 1 Oct 2008 17:25:13 +0000 (UTC)
Author: mccann
Date: Wed Oct 1 17:25:13 2008
New Revision: 5958
URL: http://svn.gnome.org/viewvc/rhythmbox?rev=5958&view=rev
Log:
2008-10-01 William Jon McCann <jmccann redhat com>
* plugins/audioscrobbler/audioscrobbler-prefs.glade:
* plugins/audioscrobbler/rb-audioscrobbler-plugin.c
(impl_activate), (impl_create_configure_dialog):
* plugins/audioscrobbler/rb-audioscrobbler.c
(rb_audioscrobbler_username_entry_focus_out_event_cb),
(rb_audioscrobbler_password_entry_focus_out_event_cb):
* plugins/audioscrobbler/rb-audioscrobbler.h:
* plugins/audioscrobbler/rb-lastfm-source.c (on_gconf_changed_cb),
(rb_lastfm_source_init), (rb_lastfm_source_dispose),
(rb_lastfm_source_constructor), (rb_lastfm_source_new),
(set_message_area_text_and_icon), (set_message_area),
(on_message_area_response), (show_error_message),
(update_message_area), (impl_get_status):
* plugins/audioscrobbler/rb-lastfm-source.h:
* widgets/Makefile.am:
* widgets/gedit-message-area.c (gedit_message_area_finalize),
(get_response_data), (find_button), (gedit_message_area_close),
(paint_message_area), (gedit_message_area_class_init), (style_set),
(gedit_message_area_init), (get_response_for_widget),
(action_widget_activated), (gedit_message_area_add_action_widget),
(gedit_message_area_set_contents), (gedit_message_area_add_button),
(add_buttons_valist), (gedit_message_area_add_buttons),
(gedit_message_area_new), (gedit_message_area_new_with_buttons),
(gedit_message_area_set_response_sensitive),
(gedit_message_area_set_default_response),
(gedit_message_area_response),
(gedit_message_area_add_stock_button_with_text):
* widgets/gedit-message-area.h:
Use a gedit-message-area widget to indicate when information
is needed to log in to the last.fm server.
Fixes #553990
Added:
trunk/widgets/gedit-message-area.c
trunk/widgets/gedit-message-area.h
Modified:
trunk/ChangeLog
trunk/plugins/audioscrobbler/audioscrobbler-prefs.glade
trunk/plugins/audioscrobbler/rb-audioscrobbler-plugin.c
trunk/plugins/audioscrobbler/rb-audioscrobbler.c
trunk/plugins/audioscrobbler/rb-audioscrobbler.h
trunk/plugins/audioscrobbler/rb-lastfm-source.c
trunk/plugins/audioscrobbler/rb-lastfm-source.h
trunk/widgets/Makefile.am
Modified: trunk/plugins/audioscrobbler/audioscrobbler-prefs.glade
==============================================================================
--- trunk/plugins/audioscrobbler/audioscrobbler-prefs.glade (original)
+++ trunk/plugins/audioscrobbler/audioscrobbler-prefs.glade Wed Oct 1 17:25:13 2008
@@ -36,7 +36,7 @@
<child>
<widget class="GtkLabel" id="audioscrobbler_label">
<property name="visible">True</property>
- <property name="label" translatable="yes">Last.fm Profile</property>
+ <property name="label" translatable="yes">Account Login</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
@@ -144,8 +144,8 @@
<property name="has_frame">True</property>
<property name="invisible_char">*</property>
<property name="activates_default">False</property>
- <signal name="changed" handler="rb_audioscrobbler_username_entry_changed_cb" last_modification_time="Tue, 22 Mar 2005 18:17:20 GMT"/>
<signal name="activate" handler="rb_audioscrobbler_username_entry_activate_cb" last_modification_time="Wed, 23 Mar 2005 07:10:03 GMT"/>
+ <signal name="focus-out-event" handler="rb_audioscrobbler_username_entry_focus_out_event_cb" last_modification_time="Tue, 30 Sep 2008 22:58:46 GMT"/>
</widget>
<packing>
<property name="left_attach">1</property>
@@ -167,8 +167,8 @@
<property name="has_frame">True</property>
<property name="invisible_char">*</property>
<property name="activates_default">False</property>
- <signal name="changed" handler="rb_audioscrobbler_password_entry_changed_cb" last_modification_time="Tue, 22 Mar 2005 18:17:40 GMT"/>
<signal name="activate" handler="rb_audioscrobbler_password_entry_activate_cb" last_modification_time="Wed, 23 Mar 2005 07:10:20 GMT"/>
+ <signal name="focus-out-event" handler="rb_audioscrobbler_password_entry_focus_out_event_cb" last_modification_time="Tue, 30 Sep 2008 22:59:11 GMT"/>
</widget>
<packing>
<property name="left_attach">1</property>
@@ -214,6 +214,60 @@
<property name="fill">False</property>
</packing>
</child>
+
+ <child>
+ <widget class="GtkHBox" id="hbox15">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">5</property>
+
+ <child>
+ <widget class="GtkLabel" id="label21">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">New to Last.fm?</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="mnemonic_widget">last_fm_link</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GnomeHRef" id="last_fm_link">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="url">http://last.fm</property>
+ <property name="text" translatable="yes">Sign up for an account</property>
+ <property name="focus_on_click">True</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="padding">0</property>
@@ -243,217 +297,257 @@
<property name="spacing">0</property>
<child>
- <widget class="GtkTable" id="table2">
+ <widget class="GtkExpander" id="expander1">
<property name="visible">True</property>
- <property name="n_rows">4</property>
- <property name="n_columns">2</property>
- <property name="homogeneous">False</property>
- <property name="row_spacing">6</property>
- <property name="column_spacing">12</property>
+ <property name="can_focus">True</property>
+ <property name="expanded">False</property>
+ <property name="spacing">5</property>
<child>
- <widget class="GtkLabel" id="label41">
+ <widget class="GtkTable" id="table2">
<property name="visible">True</property>
- <property name="label" translatable="yes">Status:</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
+ <property name="n_rows">4</property>
+ <property name="n_columns">2</property>
+ <property name="homogeneous">False</property>
+ <property name="row_spacing">6</property>
+ <property name="column_spacing">12</property>
- <child>
- <widget class="GtkLabel" id="label42">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Queued tracks:</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
+ <child>
+ <widget class="GtkLabel" id="label41">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Status:</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
- <child>
- <widget class="GtkLabel" id="label43">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Tracks submitted:</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
+ <child>
+ <widget class="GtkLabel" id="label42">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Queued tracks:</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
- <child>
- <widget class="GtkLabel" id="status_label">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Disabled</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">1</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- <property name="y_options"></property>
- </packing>
- </child>
+ <child>
+ <widget class="GtkLabel" id="label43">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Tracks submitted:</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
- <child>
- <widget class="GtkLabel" id="queue_count_label">
- <property name="visible">True</property>
- <property name="label" translatable="yes">0</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">1</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="y_options"></property>
- </packing>
- </child>
+ <child>
+ <widget class="GtkLabel" id="label44">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Last submission time:</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
- <child>
- <widget class="GtkLabel" id="submit_count_label">
- <property name="visible">True</property>
- <property name="label" translatable="yes">0</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">1</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="y_options"></property>
- </packing>
- </child>
+ <child>
+ <widget class="GtkLabel" id="submit_time_label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Never</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
- <child>
- <widget class="GtkLabel" id="label44">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Last submission time:</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
+ <child>
+ <widget class="GtkLabel" id="status_label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Disabled</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">1</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="queue_count_label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">0</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="submit_count_label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">0</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
</widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
</child>
<child>
- <widget class="GtkLabel" id="submit_time_label">
+ <widget class="GtkLabel" id="statistics_label">
<property name="visible">True</property>
- <property name="label" translatable="yes">Never</property>
+ <property name="label" translatable="yes">Statistics</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
- <property name="xalign">1</property>
+ <property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
@@ -463,12 +557,7 @@
<property name="angle">0</property>
</widget>
<packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
+ <property name="type">label_item</property>
</packing>
</child>
</widget>
@@ -493,151 +582,17 @@
<property name="spacing">0</property>
<child>
- <widget class="GtkHBox" id="hbox15">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
-
- <child>
- <widget class="GtkLabel" id="label21">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Find out about Last.fm at </property>
- <property name="use_underline">True</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="mnemonic_widget">last_fm_link</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GnomeHRef" id="last_fm_link">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="url">http://last.fm</property>
- <property name="text" translatable="yes">http://last.fm</property>
- <property name="focus_on_click">True</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
<widget class="GtkHBox" id="hbox17">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
- <widget class="GtkLabel" id="label27">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Join the Rhythmbox group at </property>
- <property name="use_underline">True</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="mnemonic_widget">rb_group_link</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
<widget class="GnomeHRef" id="rb_group_link">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="url">http://last.fm/group/Rhythmbox</property>
- <property name="text" translatable="yes">http://last.fm/group/Rhythmbox</property>
- <property name="focus_on_click">True</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hbox19">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
-
- <child>
- <widget class="GtkLabel" id="label45">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Check Last.fm server status at</property>
- <property name="use_underline">True</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="mnemonic_widget">last_fm_link</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GnomeHRef" id="href1">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="url">http://status.last.fm/</property>
- <property name="text" translatable="yes">http://status.last.fm/</property>
+ <property name="text" translatable="yes">Join the Rhythmbox group</property>
<property name="focus_on_click">True</property>
</widget>
<packing>
Modified: trunk/plugins/audioscrobbler/rb-audioscrobbler-plugin.c
==============================================================================
--- trunk/plugins/audioscrobbler/rb-audioscrobbler-plugin.c (original)
+++ trunk/plugins/audioscrobbler/rb-audioscrobbler-plugin.c Wed Oct 1 17:25:13 2008
@@ -156,7 +156,7 @@
NULL);
g_free (file);
- plugin->lastfm_source = rb_lastfm_source_new (shell);
+ plugin->lastfm_source = rb_lastfm_source_new (bplugin, shell);
icon_filename = rb_plugin_find_file (bplugin, "as-icon.png");
gtk_icon_size_lookup (GTK_ICON_SIZE_LARGE_TOOLBAR, &icon_size, NULL);
@@ -213,11 +213,15 @@
widget = rb_audioscrobbler_get_config_widget (plugin->audioscrobbler, bplugin);
- plugin->preferences = gtk_dialog_new_with_buttons (_("Audioscrobbler preferences"),
+ plugin->preferences = gtk_dialog_new_with_buttons (_("Last.fm Preferences"),
NULL,
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
NULL);
+ gtk_dialog_set_has_separator (GTK_DIALOG (plugin->preferences), FALSE);
+ gtk_container_set_border_width (GTK_CONTAINER (plugin->preferences), 5);
+ gtk_window_set_resizable (GTK_WINDOW (plugin->preferences), FALSE);
+
g_signal_connect (G_OBJECT (plugin->preferences),
"response",
G_CALLBACK (preferences_response_cb),
Modified: trunk/plugins/audioscrobbler/rb-audioscrobbler.c
==============================================================================
--- trunk/plugins/audioscrobbler/rb-audioscrobbler.c (original)
+++ trunk/plugins/audioscrobbler/rb-audioscrobbler.c Wed Oct 1 17:25:13 2008
@@ -1315,11 +1315,11 @@
void
-rb_audioscrobbler_username_entry_changed_cb (GtkEntry *entry,
- RBAudioscrobbler *audioscrobbler)
+rb_audioscrobbler_username_entry_focus_out_event_cb (GtkWidget *widget,
+ RBAudioscrobbler *audioscrobbler)
{
eel_gconf_set_string (CONF_AUDIOSCROBBLER_USERNAME,
- gtk_entry_get_text (entry));
+ gtk_entry_get_text (GTK_ENTRY (widget)));
}
void
@@ -1330,11 +1330,11 @@
}
void
-rb_audioscrobbler_password_entry_changed_cb (GtkEntry *entry,
- RBAudioscrobbler *audioscrobbler)
+rb_audioscrobbler_password_entry_focus_out_event_cb (GtkWidget *widget,
+ RBAudioscrobbler *audioscrobbler)
{
eel_gconf_set_string (CONF_AUDIOSCROBBLER_PASSWORD,
- gtk_entry_get_text (entry));
+ gtk_entry_get_text (GTK_ENTRY (widget)));
}
void
Modified: trunk/plugins/audioscrobbler/rb-audioscrobbler.h
==============================================================================
--- trunk/plugins/audioscrobbler/rb-audioscrobbler.h (original)
+++ trunk/plugins/audioscrobbler/rb-audioscrobbler.h Wed Oct 1 17:25:13 2008
@@ -70,12 +70,12 @@
GtkWidget * rb_audioscrobbler_get_config_widget (RBAudioscrobbler *audioscrobbler,
RBPlugin *plugin);
-void rb_audioscrobbler_username_entry_changed_cb (GtkEntry *entry,
- RBAudioscrobbler *audioscrobbler);
+void rb_audioscrobbler_username_entry_focus_out_event_cb (GtkWidget *widget,
+ RBAudioscrobbler *audioscrobbler);
void rb_audioscrobbler_username_entry_activate_cb (GtkEntry *entry,
RBAudioscrobbler *audioscrobbler);
-void rb_audioscrobbler_password_entry_changed_cb (GtkEntry *entry,
+void rb_audioscrobbler_password_entry_focus_out_event_cb (GtkWidget *widget,
RBAudioscrobbler *audioscrobbler);
void rb_audioscrobbler_password_entry_activate_cb (GtkEntry *entry,
RBAudioscrobbler *audioscrobbler);
Modified: trunk/plugins/audioscrobbler/rb-lastfm-source.c
==============================================================================
--- trunk/plugins/audioscrobbler/rb-lastfm-source.c (original)
+++ trunk/plugins/audioscrobbler/rb-lastfm-source.c Wed Oct 1 17:25:13 2008
@@ -76,6 +76,7 @@
#include "rb-dialog.h"
#include "rb-debug.h"
#include "eel-gconf-extensions.h"
+#include "gedit-message-area.h"
#include "rb-shell-player.h"
#include "rb-play-order.h"
#include "rb-lastfm-play-order.h"
@@ -208,10 +209,13 @@
struct RBLastfmSourcePrivate
{
+ GtkWidget *main_box;
GtkWidget *paned;
+ GtkWidget *message_area;
GtkWidget *txtbox;
GtkWidget *typecombo;
- RhythmDB *db;
+ GtkWidget *config_widget;
+ RhythmDB *db;
GtkActionGroup *action_group;
@@ -240,6 +244,9 @@
STATION_FAILED
} state;
+ guint notification_username_id;
+ guint notification_password_id;
+
GQueue *action_queue;
gboolean request_outstanding;
const char *request_description;
@@ -351,11 +358,43 @@
}
static void
+on_gconf_changed_cb (GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry,
+ RBLastfmSource *source)
+{
+ rb_debug ("GConf key updated: \"%s\"", entry->key);
+
+
+ if (source->priv->state == CONNECTED) {
+ return;
+ }
+
+ if (strcmp (entry->key, CONF_AUDIOSCROBBLER_USERNAME) == 0
+ || strcmp (entry->key, CONF_AUDIOSCROBBLER_PASSWORD) == 0) {
+ source->priv->state = NOT_CONNECTED;
+ queue_handshake (source);
+ } else {
+ rb_debug ("Unhandled GConf key updated: \"%s\"", entry->key);
+ }
+}
+
+static void
rb_lastfm_source_init (RBLastfmSource *source)
{
source->priv = G_TYPE_INSTANCE_GET_PRIVATE ((source), RB_TYPE_LASTFM_SOURCE, RBLastfmSourcePrivate);
source->priv->action_queue = g_queue_new ();
+
+ source->priv->notification_username_id =
+ eel_gconf_notification_add (CONF_AUDIOSCROBBLER_USERNAME,
+ (GConfClientNotifyFunc) on_gconf_changed_cb,
+ source);
+ source->priv->notification_password_id =
+ eel_gconf_notification_add (CONF_AUDIOSCROBBLER_PASSWORD,
+ (GConfClientNotifyFunc) on_gconf_changed_cb,
+ source);
+
}
static void
@@ -391,6 +430,15 @@
source->priv->query_model = NULL;
}
+ if (source->priv->notification_username_id != 0) {
+ eel_gconf_notification_remove (source->priv->notification_username_id);
+ source->priv->notification_username_id = 0;
+ }
+ if (source->priv->notification_password_id != 0) {
+ eel_gconf_notification_remove (source->priv->notification_password_id);
+ source->priv->notification_password_id = 0;
+ }
+
/* kill entries here? */
G_OBJECT_CLASS (rb_lastfm_source_parent_class)->dispose (object);
@@ -421,7 +469,6 @@
RBLastfmSourceClass *klass;
RBShell *shell;
GtkWidget *editor_vbox;
- GtkWidget *main_box;
GtkWidget *editor_box;
GtkWidget *add_button;
GtkWidget *instructions;
@@ -536,10 +583,10 @@
gtk_paned_pack1 (GTK_PANED (source->priv->paned), GTK_WIDGET (source->priv->stations), TRUE, TRUE);
gtk_paned_pack2 (GTK_PANED (source->priv->paned), GTK_WIDGET (source->priv->tracks), TRUE, TRUE);
- main_box = gtk_vbox_new (FALSE, 5);
- gtk_box_pack_start (GTK_BOX (main_box), editor_vbox, FALSE, FALSE, 5);
- gtk_box_pack_start_defaults (GTK_BOX (main_box), source->priv->paned);
- gtk_container_add (GTK_CONTAINER (source), main_box);
+ source->priv->main_box = gtk_vbox_new (FALSE, 5);
+ gtk_box_pack_start (GTK_BOX (source->priv->main_box), editor_vbox, FALSE, FALSE, 5);
+ gtk_box_pack_start_defaults (GTK_BOX (source->priv->main_box), source->priv->paned);
+ gtk_container_add (GTK_CONTAINER (source), source->priv->main_box);
gtk_widget_show_all (GTK_WIDGET (source));
@@ -641,7 +688,8 @@
RBSource *
-rb_lastfm_source_new (RBShell *shell)
+rb_lastfm_source_new (RBPlugin *plugin,
+ RBShell *shell)
{
RBSource *source;
RBProxyConfig *proxy_config;
@@ -675,6 +723,7 @@
g_object_get (G_OBJECT (shell), "proxy-config", &proxy_config, NULL);
source = RB_SOURCE (g_object_new (RB_TYPE_LASTFM_SOURCE,
+ "plugin", plugin,
"name", _("Last.fm"),
"shell", shell,
"station-entry-type", station_entry_type,
@@ -710,32 +759,185 @@
}
static void
-impl_get_status (RBSource *asource, char **text, char **progress_text, float *progress)
+set_message_area_text_and_icon (RBLastfmSource *source,
+ const char *icon_stock_id,
+ const char *primary_text,
+ const char *secondary_text)
+{
+ GtkWidget *hbox_content;
+ GtkWidget *image;
+ GtkWidget *vbox;
+ char *primary_markup;
+ char *secondary_markup;
+ GtkWidget *primary_label;
+ GtkWidget *secondary_label;
+
+ hbox_content = gtk_hbox_new (FALSE, 8);
+ gtk_widget_show (hbox_content);
+
+ image = gtk_image_new_from_stock (icon_stock_id, GTK_ICON_SIZE_DIALOG);
+ gtk_widget_show (image);
+ gtk_box_pack_start (GTK_BOX (hbox_content), image, FALSE, FALSE, 0);
+ gtk_misc_set_alignment (GTK_MISC (image), 0.5, 0);
+
+ vbox = gtk_vbox_new (FALSE, 6);
+ gtk_widget_show (vbox);
+ gtk_box_pack_start (GTK_BOX (hbox_content), vbox, TRUE, TRUE, 0);
+
+ primary_markup = g_strdup_printf ("<b>%s</b>", primary_text);
+ primary_label = gtk_label_new (primary_markup);
+ g_free (primary_markup);
+ gtk_widget_show (primary_label);
+ gtk_box_pack_start (GTK_BOX (vbox), primary_label, TRUE, TRUE, 0);
+ gtk_label_set_use_markup (GTK_LABEL (primary_label), TRUE);
+ gtk_label_set_line_wrap (GTK_LABEL (primary_label), TRUE);
+ gtk_misc_set_alignment (GTK_MISC (primary_label), 0, 0.5);
+ GTK_WIDGET_SET_FLAGS (primary_label, GTK_CAN_FOCUS);
+ gtk_label_set_selectable (GTK_LABEL (primary_label), TRUE);
+
+ if (secondary_text != NULL) {
+ secondary_markup = g_strdup_printf ("<small>%s</small>",
+ secondary_text);
+ secondary_label = gtk_label_new (secondary_markup);
+ g_free (secondary_markup);
+ gtk_widget_show (secondary_label);
+ gtk_box_pack_start (GTK_BOX (vbox), secondary_label, TRUE, TRUE, 0);
+ GTK_WIDGET_SET_FLAGS (secondary_label, GTK_CAN_FOCUS);
+ gtk_label_set_use_markup (GTK_LABEL (secondary_label), TRUE);
+ gtk_label_set_line_wrap (GTK_LABEL (secondary_label), TRUE);
+ gtk_label_set_selectable (GTK_LABEL (secondary_label), TRUE);
+ gtk_misc_set_alignment (GTK_MISC (secondary_label), 0, 0.5);
+ }
+
+ gtk_widget_show (source->priv->message_area);
+ gedit_message_area_set_contents (GEDIT_MESSAGE_AREA (source->priv->message_area),
+ hbox_content);
+}
+
+static void
+set_message_area (RBLastfmSource *source,
+ GtkWidget *area)
{
- RBLastfmSource *source = RB_LASTFM_SOURCE (asource);
- RhythmDBQueryModel *model;
+ if (source->priv->message_area == area) {
+ return;
+ }
+
+ if (source->priv->message_area) {
+ gtk_widget_destroy (source->priv->message_area);
+ }
+ source->priv->message_area = area;
+
+ if (area == NULL) {
+ return;
+ }
+
+ gtk_box_pack_end (GTK_BOX (source->priv->main_box),
+ source->priv->message_area,
+ FALSE, FALSE, 0);
+#if 0
+ gtk_box_reorder_child (GTK_BOX (source->priv->view_box),
+ source->priv->message_area, 0);
+#endif
+ g_object_add_weak_pointer (G_OBJECT (source->priv->message_area),
+ (gpointer) &(source->priv->message_area));
+}
+
+static void
+on_message_area_response (GeditMessageArea *area,
+ int response_id,
+ RBLastfmSource *source)
+{
+ RBPlugin *plugin;
+ GtkWidget *dialog;
+
+ g_object_get (source, "plugin", &plugin, NULL);
+ dialog = rb_plugin_create_configure_dialog (plugin);
+ g_object_unref (plugin);
+}
+
+static void
+show_error_message (RBLastfmSource *source,
+ const char *primary_text,
+ const char *secondary_text)
+{
+ GtkWidget *area;
+
+ if (source->priv->message_area != NULL) {
+ return;
+ }
+
+ area = gedit_message_area_new_with_buttons (_("Account Settings"),
+ GTK_RESPONSE_ACCEPT,
+ NULL);
+ set_message_area (source, area);
+ set_message_area_text_and_icon (source,
+ "gtk-dialog-error",
+ primary_text,
+ secondary_text);
+ g_signal_connect (area,
+ "response",
+ G_CALLBACK (on_message_area_response),
+ source);
+}
+
+static void
+update_message_area (RBLastfmSource *source)
+{
+ char *primary_text;
+ char *secondary_text;
+
+ primary_text = NULL;
+ secondary_text = NULL;
switch (source->priv->state) {
case LOGIN_FAILED:
- *text = g_strdup (_("Could not log in to Last.fm. Check your username and password."));
+ primary_text = g_strdup (_("Account details are needed before you can connect. Check your settings."));
break;
case BANNED:
- *text = g_strdup (_("This version of Rhythmbox has been banned from Last.fm."));
+ primary_text = g_strdup (_("This version of Rhythmbox has been banned from Last.fm."));
break;
case STATION_FAILED:
- *text = g_strdup (source->priv->station_failed_reason);
+ primary_text = g_strdup (_("Unable to connect"));
+ secondary_text = g_strdup (source->priv->station_failed_reason);
break;
case NOT_CONNECTED:
case CONNECTED:
+ set_message_area (source, NULL);
+ break;
+ default:
+ g_assert_not_reached ();
+ break;
+ }
+
+ if (primary_text != NULL) {
+ show_error_message (source, primary_text, secondary_text);
+ }
+}
+
+static void
+impl_get_status (RBSource *asource, char **text, char **progress_text, float *progress)
+{
+ RBLastfmSource *source = RB_LASTFM_SOURCE (asource);
+ RhythmDBQueryModel *model;
+
+ switch (source->priv->state) {
+ case LOGIN_FAILED:
+ case BANNED:
+ case STATION_FAILED:
+ break;
+ case NOT_CONNECTED:
+ case CONNECTED:
g_object_get (asource, "query-model", &model, NULL);
*text = rhythmdb_query_model_compute_status_normal (model, "%d songs", "%d songs");
g_object_unref (model);
break;
}
+ update_message_area (source);
+
rb_streaming_source_get_progress (RB_STREAMING_SOURCE (source), progress_text, progress);
/* pulse progressbar if there's something going on */
Modified: trunk/plugins/audioscrobbler/rb-lastfm-source.h
==============================================================================
--- trunk/plugins/audioscrobbler/rb-lastfm-source.h (original)
+++ trunk/plugins/audioscrobbler/rb-lastfm-source.h Wed Oct 1 17:25:13 2008
@@ -59,7 +59,8 @@
GType rb_lastfm_source_get_type (void);
GType rb_lastfm_source_register_type (GTypeModule *module);
-RBSource * rb_lastfm_source_new (RBShell *shell);
+RBSource * rb_lastfm_source_new (RBPlugin *plugin,
+ RBShell *shell);
G_END_DECLS
Modified: trunk/widgets/Makefile.am
==============================================================================
--- trunk/widgets/Makefile.am (original)
+++ trunk/widgets/Makefile.am Wed Oct 1 17:25:13 2008
@@ -28,6 +28,8 @@
rb-cell-renderer-rating.h \
gossip-cell-renderer-expander.c \
gossip-cell-renderer-expander.h \
+ gedit-message-area.c \
+ gedit-message-area.h \
rb-song-info.c \
rb-song-info.h \
rb-rating.c \
Added: trunk/widgets/gedit-message-area.c
==============================================================================
--- (empty file)
+++ trunk/widgets/gedit-message-area.c Wed Oct 1 17:25:13 2008
@@ -0,0 +1,634 @@
+/*
+ * gedit-message-area.c
+ * This file is part of gedit
+ *
+ * Copyright (C) 2005 - Paolo Maggi
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * The Rhythmbox authors hereby grants permission for non-GPL compatible
+ * GStreamer plugins to be used and distributed together with GStreamer
+ * and Rhythmbox. This permission is above and beyond the permissions granted
+ * by the GPL license by which Rhythmbox is covered. If you modify this code
+ * you may extend this exception to your version of the code, but you are not
+ * obligated to do so. If you do not wish to do so, delete this exception
+ * statement from your version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the gedit Team, 2005. See the AUTHORS file for a
+ * list of people on the gedit Team.
+ * See the ChangeLog files for a list of changes.
+ *
+ * $Id: gedit-message-area.c 6468 2008-08-28 08:23:00Z icq $
+ */
+
+/* TODO: Style properties */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n.h>
+#include <gtk/gtk.h>
+#include <gdk/gdk.h>
+#include <gdk/gdkkeysyms.h>
+
+#include "gedit-message-area.h"
+
+#define GEDIT_MESSAGE_AREA_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), \
+ GEDIT_TYPE_MESSAGE_AREA, \
+ GeditMessageAreaPrivate))
+
+struct _GeditMessageAreaPrivate
+{
+ GtkWidget *main_hbox;
+
+ GtkWidget *contents;
+ GtkWidget *action_area;
+
+ gboolean changing_style;
+};
+
+typedef struct _ResponseData ResponseData;
+
+struct _ResponseData
+{
+ gint response_id;
+};
+
+enum {
+ RESPONSE,
+ CLOSE,
+ LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL];
+
+G_DEFINE_TYPE(GeditMessageArea, gedit_message_area, GTK_TYPE_HBOX)
+
+
+static void
+gedit_message_area_finalize (GObject *object)
+{
+ /*
+ GeditMessageArea *message_area = GEDIT_MESSAGE_AREA (object);
+ */
+
+ G_OBJECT_CLASS (gedit_message_area_parent_class)->finalize (object);
+}
+
+static ResponseData *
+get_response_data (GtkWidget *widget,
+ gboolean create)
+{
+ ResponseData *ad = g_object_get_data (G_OBJECT (widget),
+ "gedit-message-area-response-data");
+
+ if (ad == NULL && create)
+ {
+ ad = g_new (ResponseData, 1);
+
+ g_object_set_data_full (G_OBJECT (widget),
+ "gedit-message-area-response-data",
+ ad,
+ g_free);
+ }
+
+ return ad;
+}
+
+static GtkWidget *
+find_button (GeditMessageArea *message_area,
+ gint response_id)
+{
+ GList *children, *tmp_list;
+ GtkWidget *child = NULL;
+
+ children = gtk_container_get_children (
+ GTK_CONTAINER (message_area->priv->action_area));
+
+ for (tmp_list = children; tmp_list; tmp_list = tmp_list->next)
+ {
+ ResponseData *rd = get_response_data (tmp_list->data, FALSE);
+
+ if (rd && rd->response_id == response_id)
+ {
+ child = tmp_list->data;
+ break;
+ }
+ }
+
+ g_list_free (children);
+
+ return child;
+}
+
+static void
+gedit_message_area_close (GeditMessageArea *message_area)
+{
+ if (!find_button (message_area, GTK_RESPONSE_CANCEL))
+ return;
+
+ /* emit response signal */
+ gedit_message_area_response (GEDIT_MESSAGE_AREA (message_area),
+ GTK_RESPONSE_CANCEL);
+}
+
+static gboolean
+paint_message_area (GtkWidget *widget,
+ GdkEventExpose *event,
+ gpointer user_data)
+{
+ gtk_paint_flat_box (widget->style,
+ widget->window,
+ GTK_STATE_NORMAL,
+ GTK_SHADOW_OUT,
+ NULL,
+ widget,
+ "tooltip",
+ widget->allocation.x + 1,
+ widget->allocation.y + 1,
+ widget->allocation.width - 2,
+ widget->allocation.height - 2);
+
+ return FALSE;
+}
+
+static void
+gedit_message_area_class_init (GeditMessageAreaClass *klass)
+{
+ GObjectClass *object_class;
+ GtkBindingSet *binding_set;
+
+ object_class = G_OBJECT_CLASS (klass);
+ object_class->finalize = gedit_message_area_finalize;
+
+ klass->close = gedit_message_area_close;
+
+ g_type_class_add_private (object_class, sizeof(GeditMessageAreaPrivate));
+
+ signals[RESPONSE] = g_signal_new ("response",
+ G_OBJECT_CLASS_TYPE (klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GeditMessageAreaClass, response),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__INT,
+ G_TYPE_NONE, 1,
+ G_TYPE_INT);
+
+ signals[CLOSE] = g_signal_new ("close",
+ G_OBJECT_CLASS_TYPE (klass),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (GeditMessageAreaClass, close),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ binding_set = gtk_binding_set_by_class (klass);
+
+ gtk_binding_entry_add_signal (binding_set, GDK_Escape, 0, "close", 0);
+}
+
+static void
+style_set (GtkWidget *widget,
+ GtkStyle *prev_style,
+ GeditMessageArea *message_area)
+{
+ GtkWidget *window;
+ GtkStyle *style;
+
+ if (message_area->priv->changing_style)
+ return;
+
+ /* This is a hack needed to use the tooltip background color */
+ window = gtk_window_new (GTK_WINDOW_POPUP);
+ gtk_widget_set_name (window, "gtk-tooltip");
+ gtk_widget_ensure_style (window);
+ style = gtk_widget_get_style (window);
+
+ message_area->priv->changing_style = TRUE;
+ gtk_widget_set_style (GTK_WIDGET (message_area), style);
+ message_area->priv->changing_style = FALSE;
+
+ gtk_widget_destroy (window);
+
+ gtk_widget_queue_draw (GTK_WIDGET (message_area));
+}
+
+static void
+gedit_message_area_init (GeditMessageArea *message_area)
+{
+ message_area->priv = GEDIT_MESSAGE_AREA_GET_PRIVATE (message_area);
+
+ message_area->priv->main_hbox = gtk_hbox_new (FALSE, 16); /* FIXME: use style properties */
+ gtk_widget_show (message_area->priv->main_hbox);
+ gtk_container_set_border_width (GTK_CONTAINER (message_area->priv->main_hbox),
+ 8); /* FIXME: use style properties */
+
+ message_area->priv->action_area = gtk_vbox_new (TRUE, 10); /* FIXME: use style properties */
+ gtk_widget_show (message_area->priv->action_area);
+ gtk_box_pack_end (GTK_BOX (message_area->priv->main_hbox),
+ message_area->priv->action_area,
+ FALSE,
+ TRUE,
+ 0);
+
+ gtk_box_pack_start (GTK_BOX (message_area),
+ message_area->priv->main_hbox,
+ TRUE,
+ TRUE,
+ 0);
+
+ gtk_widget_set_app_paintable (GTK_WIDGET (message_area), TRUE);
+
+ g_signal_connect (message_area,
+ "expose-event",
+ G_CALLBACK (paint_message_area),
+ NULL);
+
+ /* Note that we connect to style-set on one of the internal
+ * widgets, not on the message area itself, since gtk does
+ * not deliver any further style-set signals for a widget on
+ * which the style has been forced with gtk_widget_set_style() */
+ g_signal_connect (message_area->priv->main_hbox,
+ "style-set",
+ G_CALLBACK (style_set),
+ message_area);
+}
+
+static gint
+get_response_for_widget (GeditMessageArea *message_area,
+ GtkWidget *widget)
+{
+ ResponseData *rd;
+
+ rd = get_response_data (widget, FALSE);
+ if (!rd)
+ return GTK_RESPONSE_NONE;
+ else
+ return rd->response_id;
+}
+
+static void
+action_widget_activated (GtkWidget *widget, GeditMessageArea *message_area)
+{
+ gint response_id;
+
+ response_id = get_response_for_widget (message_area, widget);
+
+ gedit_message_area_response (message_area, response_id);
+}
+
+void
+gedit_message_area_add_action_widget (GeditMessageArea *message_area,
+ GtkWidget *child,
+ gint response_id)
+{
+ ResponseData *ad;
+ guint signal_id;
+
+ g_return_if_fail (GEDIT_IS_MESSAGE_AREA (message_area));
+ g_return_if_fail (GTK_IS_WIDGET (child));
+
+ ad = get_response_data (child, TRUE);
+
+ ad->response_id = response_id;
+
+ if (GTK_IS_BUTTON (child))
+ signal_id = g_signal_lookup ("clicked", GTK_TYPE_BUTTON);
+ else
+ signal_id = GTK_WIDGET_GET_CLASS (child)->activate_signal;
+
+ if (signal_id)
+ {
+ GClosure *closure;
+
+ closure = g_cclosure_new_object (G_CALLBACK (action_widget_activated),
+ G_OBJECT (message_area));
+
+ g_signal_connect_closure_by_id (child,
+ signal_id,
+ 0,
+ closure,
+ FALSE);
+ }
+ else
+ g_warning ("Only 'activatable' widgets can be packed into the action area of a GeditMessageArea");
+
+ if (response_id != GTK_RESPONSE_HELP)
+ gtk_box_pack_start (GTK_BOX (message_area->priv->action_area),
+ child,
+ FALSE,
+ FALSE,
+ 0);
+ else
+ gtk_box_pack_end (GTK_BOX (message_area->priv->action_area),
+ child,
+ FALSE,
+ FALSE,
+ 0);
+}
+
+/**
+ * gedit_message_area_set_contents:
+ * @message_area: a #GeditMessageArea
+ * @contents: widget you want to add to the contents area
+ *
+ * Adds the @contents widget to the contents area of #GeditMessageArea.
+ */
+void
+gedit_message_area_set_contents (GeditMessageArea *message_area,
+ GtkWidget *contents)
+{
+ g_return_if_fail (GEDIT_IS_MESSAGE_AREA (message_area));
+ g_return_if_fail (GTK_IS_WIDGET (contents));
+
+ message_area->priv->contents = contents;
+ gtk_box_pack_start (GTK_BOX (message_area->priv->main_hbox),
+ message_area->priv->contents,
+ TRUE,
+ TRUE,
+ 0);
+}
+
+/**
+ * gedit_message_area_add_button:
+ * @message_area: a #GeditMessageArea
+ * @button_text: text of button, or stock ID
+ * @response_id: response ID for the button
+ *
+ * Adds a button with the given text (or a stock button, if button_text is a stock ID)
+ * and sets things up so that clicking the button will emit the "response" signal
+ * with the given response_id. The button is appended to the end of the message area's
+ * action area. The button widget is returned, but usually you don't need it.
+ *
+ * Returns: the button widget that was added
+ */
+GtkWidget*
+gedit_message_area_add_button (GeditMessageArea *message_area,
+ const gchar *button_text,
+ gint response_id)
+{
+ GtkWidget *button;
+
+ g_return_val_if_fail (GEDIT_IS_MESSAGE_AREA (message_area), NULL);
+ g_return_val_if_fail (button_text != NULL, NULL);
+
+ button = gtk_button_new_from_stock (button_text);
+
+ GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
+
+ gtk_widget_show (button);
+
+ gedit_message_area_add_action_widget (message_area,
+ button,
+ response_id);
+
+ return button;
+}
+
+static void
+add_buttons_valist (GeditMessageArea *message_area,
+ const gchar *first_button_text,
+ va_list args)
+{
+ const gchar* text;
+ gint response_id;
+
+ g_return_if_fail (GEDIT_IS_MESSAGE_AREA (message_area));
+
+ if (first_button_text == NULL)
+ return;
+
+ text = first_button_text;
+ response_id = va_arg (args, gint);
+
+ while (text != NULL)
+ {
+ gedit_message_area_add_button (message_area,
+ text,
+ response_id);
+
+ text = va_arg (args, gchar*);
+ if (text == NULL)
+ break;
+
+ response_id = va_arg (args, int);
+ }
+}
+
+/**
+ * gedit_message_area_add_buttons:
+ * @message_area: a #GeditMessageArea
+ * @first_button_text: button text or stock ID
+ * @...: response ID for first button, then more text-response_id pairs
+ *
+ * Adds more buttons, same as calling gedit_message_area_add_button() repeatedly.
+ * The variable argument list should be NULL-terminated as with
+ * gedit_message_area_new_with_buttons(). Each button must have both text and response ID.
+ */
+void
+gedit_message_area_add_buttons (GeditMessageArea *message_area,
+ const gchar *first_button_text,
+ ...)
+{
+ va_list args;
+
+ va_start (args, first_button_text);
+
+ add_buttons_valist (message_area,
+ first_button_text,
+ args);
+
+ va_end (args);
+}
+
+/**
+ * gedit_message_area_new:
+ *
+ * Creates a new #GeditMessageArea object.
+ *
+ * Returns: a new #GeditMessageArea object
+ */
+GtkWidget *
+gedit_message_area_new (void)
+{
+ return g_object_new (GEDIT_TYPE_MESSAGE_AREA, NULL);
+}
+
+/**
+ * gedit_message_area_new_with_buttons:
+ * @first_button_text: stock ID or text to go in first button, or NULL
+ * @...: response ID for first button, then additional buttons, ending with NULL
+ *
+ * Creates a new #GeditMessageArea with buttons. Button text/response ID pairs
+ * should be listed, with a NULL pointer ending the list. Button text can be either
+ * a stock ID such as GTK_STOCK_OK, or some arbitrary text. A response ID can be any
+ * positive number, or one of the values in the GtkResponseType enumeration. If
+ * the user clicks one of these dialog buttons, GeditMessageArea will emit the "response"
+ * signal with the corresponding response ID.
+ *
+ * Returns: a new #GeditMessageArea
+ */
+GtkWidget *
+gedit_message_area_new_with_buttons (const gchar *first_button_text,
+ ...)
+{
+ GeditMessageArea *message_area;
+ va_list args;
+
+ message_area = GEDIT_MESSAGE_AREA (gedit_message_area_new ());
+
+ va_start (args, first_button_text);
+
+ add_buttons_valist (message_area,
+ first_button_text,
+ args);
+
+ va_end (args);
+
+ return GTK_WIDGET (message_area);
+}
+
+/**
+ * gedit_message_area_set_response_sensitive:
+ * @message_area: a #GeditMessageArea
+ * @response_id: a response ID
+ * @setting: TRUE for sensitive
+ *
+ * Calls gtk_widget_set_sensitive (widget, setting) for each widget in the dialog's
+ * action area with the given response_id. A convenient way to sensitize/desensitize
+ * dialog buttons.
+ */
+void
+gedit_message_area_set_response_sensitive (GeditMessageArea *message_area,
+ gint response_id,
+ gboolean setting)
+{
+ GList *children;
+ GList *tmp_list;
+
+ g_return_if_fail (GEDIT_IS_MESSAGE_AREA (message_area));
+
+ children = gtk_container_get_children (GTK_CONTAINER (message_area->priv->action_area));
+
+ tmp_list = children;
+ while (tmp_list != NULL)
+ {
+ GtkWidget *widget = tmp_list->data;
+ ResponseData *rd = get_response_data (widget, FALSE);
+
+ if (rd && rd->response_id == response_id)
+ gtk_widget_set_sensitive (widget, setting);
+
+ tmp_list = g_list_next (tmp_list);
+ }
+
+ g_list_free (children);
+}
+
+/**
+ * gedit_message_area_set_default_response:
+ * @message_area: a #GeditMessageArea
+ * @response_id: a response ID
+ *
+ * Sets the last widget in the message area's action area with the given response_id
+ * as the default widget for the dialog. Pressing "Enter" normally activates the
+ * default widget.
+ */
+void
+gedit_message_area_set_default_response (GeditMessageArea *message_area,
+ gint response_id)
+{
+ GList *children;
+ GList *tmp_list;
+
+ g_return_if_fail (GEDIT_IS_MESSAGE_AREA (message_area));
+
+ children = gtk_container_get_children (GTK_CONTAINER (message_area->priv->action_area));
+
+ tmp_list = children;
+ while (tmp_list != NULL)
+ {
+ GtkWidget *widget = tmp_list->data;
+ ResponseData *rd = get_response_data (widget, FALSE);
+
+ if (rd && rd->response_id == response_id)
+ gtk_widget_grab_default (widget);
+
+ tmp_list = g_list_next (tmp_list);
+ }
+
+ g_list_free (children);
+}
+
+/**
+ * gedit_message_area_set_default_response:
+ * @message_area: a #GeditMessageArea
+ * @response_id: a response ID
+ *
+ * Emits the 'response' signal with the given @response_id.
+ */
+void
+gedit_message_area_response (GeditMessageArea *message_area,
+ gint response_id)
+{
+ g_return_if_fail (GEDIT_IS_MESSAGE_AREA (message_area));
+
+ g_signal_emit (message_area,
+ signals[RESPONSE],
+ 0,
+ response_id);
+}
+
+/**
+ * gedit_message_area_add_stock_button_with_text:
+ * @message_area: a #GeditMessageArea
+ * @text: the text to visualize in the button
+ * @stock_id: the stock ID of the button
+ * @response_id: a response ID
+ *
+ * Same as gedit_message_area_add_button() but with a specific text.
+ */
+GtkWidget *
+gedit_message_area_add_stock_button_with_text (GeditMessageArea *message_area,
+ const gchar *text,
+ const gchar *stock_id,
+ gint response_id)
+{
+ GtkWidget *button;
+
+ g_return_val_if_fail (GEDIT_IS_MESSAGE_AREA (message_area), NULL);
+ g_return_val_if_fail (text != NULL, NULL);
+ g_return_val_if_fail (stock_id != NULL, NULL);
+
+ button = gtk_button_new_with_mnemonic (text);
+ gtk_button_set_image (GTK_BUTTON (button),
+ gtk_image_new_from_stock (stock_id,
+ GTK_ICON_SIZE_BUTTON));
+
+ GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
+
+ gtk_widget_show (button);
+
+ gedit_message_area_add_action_widget (message_area,
+ button,
+ response_id);
+
+ return button;
+}
+
Added: trunk/widgets/gedit-message-area.h
==============================================================================
--- (empty file)
+++ trunk/widgets/gedit-message-area.h Wed Oct 1 17:25:13 2008
@@ -0,0 +1,137 @@
+/*
+ * gedit-message-area.h
+ * This file is part of gedit
+ *
+ * Copyright (C) 2005 - Paolo Maggi
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * The Rhythmbox authors hereby grants permission for non-GPL compatible
+ * GStreamer plugins to be used and distributed together with GStreamer
+ * and Rhythmbox. This permission is above and beyond the permissions granted
+ * by the GPL license by which Rhythmbox is covered. If you modify this code
+ * you may extend this exception to your version of the code, but you are not
+ * obligated to do so. If you do not wish to do so, delete this exception
+ * statement from your version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the gedit Team, 2005. See the AUTHORS file for a
+ * list of people on the gedit Team.
+ * See the ChangeLog files for a list of changes.
+ *
+ * $Id: gedit-message-area.h 6138 2008-02-01 14:32:22Z icq $
+ */
+
+#ifndef __GEDIT_MESSAGE_AREA_H__
+#define __GEDIT_MESSAGE_AREA_H__
+
+#include <gtk/gtkhbox.h>
+
+G_BEGIN_DECLS
+
+/*
+ * Type checking and casting macros
+ */
+#define GEDIT_TYPE_MESSAGE_AREA (gedit_message_area_get_type())
+#define GEDIT_MESSAGE_AREA(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GEDIT_TYPE_MESSAGE_AREA, GeditMessageArea))
+#define GEDIT_MESSAGE_AREA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GEDIT_TYPE_MESSAGE_AREA, GeditMessageAreaClass))
+#define GEDIT_IS_MESSAGE_AREA(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GEDIT_TYPE_MESSAGE_AREA))
+#define GEDIT_IS_MESSAGE_AREA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEDIT_TYPE_MESSAGE_AREA))
+#define GEDIT_MESSAGE_AREA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GEDIT_TYPE_MESSAGE_AREA, GeditMessageAreaClass))
+
+/* Private structure type */
+typedef struct _GeditMessageAreaPrivate GeditMessageAreaPrivate;
+
+/*
+ * Main object structure
+ */
+typedef struct _GeditMessageArea GeditMessageArea;
+
+struct _GeditMessageArea
+{
+ GtkHBox parent;
+
+ /*< private > */
+ GeditMessageAreaPrivate *priv;
+};
+
+/*
+ * Class definition
+ */
+typedef struct _GeditMessageAreaClass GeditMessageAreaClass;
+
+struct _GeditMessageAreaClass
+{
+ GtkHBoxClass parent_class;
+
+ /* Signals */
+ void (* response) (GeditMessageArea *message_area, gint response_id);
+
+ /* Keybinding signals */
+ void (* close) (GeditMessageArea *message_area);
+
+ /* Padding for future expansion */
+ void (*_gedit_reserved1) (void);
+ void (*_gedit_reserved2) (void);
+};
+
+/*
+ * Public methods
+ */
+GType gedit_message_area_get_type (void) G_GNUC_CONST;
+
+GtkWidget *gedit_message_area_new (void);
+
+GtkWidget *gedit_message_area_new_with_buttons (const gchar *first_button_text,
+ ...);
+
+void gedit_message_area_set_contents (GeditMessageArea *message_area,
+ GtkWidget *contents);
+
+void gedit_message_area_add_action_widget (GeditMessageArea *message_area,
+ GtkWidget *child,
+ gint response_id);
+
+GtkWidget *gedit_message_area_add_button (GeditMessageArea *message_area,
+ const gchar *button_text,
+ gint response_id);
+
+GtkWidget *gedit_message_area_add_stock_button_with_text
+ (GeditMessageArea *message_area,
+ const gchar *text,
+ const gchar *stock_id,
+ gint response_id);
+
+void gedit_message_area_add_buttons (GeditMessageArea *message_area,
+ const gchar *first_button_text,
+ ...);
+
+void gedit_message_area_set_response_sensitive
+ (GeditMessageArea *message_area,
+ gint response_id,
+ gboolean setting);
+void gedit_message_area_set_default_response
+ (GeditMessageArea *message_area,
+ gint response_id);
+
+/* Emit response signal */
+void gedit_message_area_response (GeditMessageArea *message_area,
+ gint response_id);
+
+G_END_DECLS
+
+#endif /* __GEDIT_MESSAGE_AREA_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]