[nautilus-actions] Add a tooltip to the writability status image
- From: Pierre Wieser <pwieser src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [nautilus-actions] Add a tooltip to the writability status image
- Date: Sun, 20 Dec 2009 10:28:27 +0000 (UTC)
commit def2a742b6253796a46edec00e1d405a3f4aa358
Author: Pierre Wieser <pwieser trychlos org>
Date: Sun Dec 20 11:28:12 2009 +0100
Add a tooltip to the writability status image
ChangeLog | 13 +++++++++
nautilus-actions/nact/nact-main-statusbar.c | 36 ++++++++++++++++++++++++---
nautilus-actions/nact/nact-main-statusbar.h | 2 +-
nautilus-actions/nact/nact-main-window.c | 6 ++--
po/POTFILES.in | 1 +
5 files changed, 50 insertions(+), 8 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 3327e7c..88a08b2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2009-12-20 Pierre Wieser <pwieser trychlos org>
+
+ Add a tooltip to the writability status image.
+
+ * nautilus-actions/nact/nact-main-statusbar.c:
+ * nautilus-actions/nact/nact-main-statusbar.h
+ (nact_main_statusbar_set_locked):
+ Displays a tooltip whether the provider or the item is read-only.
+
+ * nautilus-actions/nact/nact-main-window.c: Updated accordingly.
+
+ * po/POTFILES.in: Add nautilus-actions/nact/nact-main-statusbar.c.
+
2009-12-19 Pierre Wieser <pwieser trychlos org>
Display the writability status in the status bar.
diff --git a/nautilus-actions/nact/nact-main-statusbar.c b/nautilus-actions/nact/nact-main-statusbar.c
index e81d947..114a5d5 100644
--- a/nautilus-actions/nact/nact-main-statusbar.c
+++ b/nautilus-actions/nact/nact-main-statusbar.c
@@ -32,6 +32,8 @@
#include <config.h>
#endif
+#include <glib/gi18n.h>
+
#include "nact-main-statusbar.h"
typedef struct {
@@ -143,19 +145,25 @@ nact_main_statusbar_hide_status( NactMainWindow *window, const gchar *context )
/**
* nact_main_statusbar_set_locked:
* @window: the #NactMainWindow instance.
- * @locked: whether the current item is locked.
+ * @provider: whether the current provider is locked (read-only).
+ * @item: whether the current item is locked (read-only).
*
* Displays the writability status of the current item as an image.
+ * Installs the corresponding tooltip.
*/
void
-nact_main_statusbar_set_locked( NactMainWindow *window, gboolean locked )
+nact_main_statusbar_set_locked( NactMainWindow *window, gboolean provider, gboolean item )
{
static const gchar *thisfn = "nact_main_statusbar_set_locked";
+ static const gchar *tooltip_provider = N_( "I/O Provider is locked down." );
+ static const gchar *tooltip_item = N_( "Item is read-only." );
GtkStatusbar *bar;
GtkFrame *frame;
GtkImage *image;
+ gchar *tooltip;
+ gchar *tmp;
- g_debug( "%s: window=%p, locked=%s", thisfn, ( void * ) window, locked ? "True":"False" );
+ g_debug( "%s: window=%p, provider=%s, item=%s", thisfn, ( void * ) window, provider ? "True":"False", item ? "True":"False" );
bar = get_statusbar( window );
frame = GTK_FRAME( base_window_get_widget( BASE_WINDOW( window ), "ActionLockedFrame" ));
@@ -163,16 +171,36 @@ nact_main_statusbar_set_locked( NactMainWindow *window, gboolean locked )
if( bar && frame && image ){
- if( locked ){
+ tooltip = g_strdup( "" );
+
+ if( provider || item ){
gtk_image_set_from_file( image, LOCKED_IMAGE );
gtk_widget_show( GTK_WIDGET( image ));
gtk_frame_set_shadow_type( frame, GTK_SHADOW_NONE );
+ if( provider ){
+ g_free( tooltip );
+ tooltip = g_strdup( tooltip_provider );
+ }
+ if( item ){
+ if( provider ){
+ tmp = g_strdup_printf( "%s\n%s", tooltip, tooltip_item );
+ g_free( tooltip );
+ tooltip = tmp;
+ } else {
+ g_free( tooltip );
+ tooltip = g_strdup( tooltip_item );
+ }
+ }
+
} else {
gtk_image_set_from_icon_name( image, "gnome-stock-blank", GTK_ICON_SIZE_MENU );
gtk_widget_hide( GTK_WIDGET( image ));
gtk_frame_set_shadow_type( frame, GTK_SHADOW_IN );
}
+
+ gtk_widget_set_tooltip_text( GTK_WIDGET( image ), tooltip );
+ g_free( tooltip );
}
}
diff --git a/nautilus-actions/nact/nact-main-statusbar.h b/nautilus-actions/nact/nact-main-statusbar.h
index 9937f5d..c9f6bd9 100644
--- a/nautilus-actions/nact/nact-main-statusbar.h
+++ b/nautilus-actions/nact/nact-main-statusbar.h
@@ -44,7 +44,7 @@ G_BEGIN_DECLS
void nact_main_statusbar_display_status( NactMainWindow *window, const gchar *context, const gchar *status );
void nact_main_statusbar_display_with_timeout( NactMainWindow *window, const gchar *context, const gchar *status );
void nact_main_statusbar_hide_status( NactMainWindow *window, const gchar *context );
-void nact_main_statusbar_set_locked( NactMainWindow *window, gboolean locked );
+void nact_main_statusbar_set_locked( NactMainWindow *window, gboolean provider, gboolean item );
G_END_DECLS
diff --git a/nautilus-actions/nact/nact-main-window.c b/nautilus-actions/nact/nact-main-window.c
index f8f4a0f..8f28423 100644
--- a/nautilus-actions/nact/nact-main-window.c
+++ b/nautilus-actions/nact/nact-main-window.c
@@ -1008,7 +1008,7 @@ on_base_initial_load_toplevel( NactMainWindow *window, gpointer user_data )
nact_iconditions_tab_initial_load_toplevel( NACT_ICONDITIONS_TAB( window ));
nact_iadvanced_tab_initial_load_toplevel( NACT_IADVANCED_TAB( window ));
- nact_main_statusbar_set_locked( window, FALSE );
+ nact_main_statusbar_set_locked( window, FALSE, FALSE );
}
}
@@ -1112,7 +1112,7 @@ on_iactions_list_selection_changed( NactIActionsList *instance, GSList *selected
return;
}
- nact_main_statusbar_set_locked( window, FALSE );
+ nact_main_statusbar_set_locked( window, FALSE, FALSE );
if( count == 1 ){
g_return_if_fail( NA_IS_OBJECT_ID( selected_items->data ));
@@ -1180,7 +1180,7 @@ set_current_object_item( NactMainWindow *window, GSList *selected_items )
window->private->readonly_item = na_object_is_readonly( window->private->edited_item );
window->private->writable_provider = nact_window_is_writable_provider( NACT_WINDOW( window ), window->private->edited_item );
- nact_main_statusbar_set_locked( window, window->private->readonly_item || !window->private->writable_provider );
+ nact_main_statusbar_set_locked( window, !window->private->writable_provider, window->private->readonly_item );
if( NA_IS_OBJECT_ACTION( window->private->edited_item )){
diff --git a/po/POTFILES.in b/po/POTFILES.in
index f102954..de82b91 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -19,6 +19,7 @@ nautilus-actions/nact/nact-iadvanced-tab.c
nautilus-actions/nact/nact-ibackground-tab.c
nautilus-actions/nact/nact-icommand-tab.c
nautilus-actions/nact/nact-main-menubar.c
+nautilus-actions/nact/nact-main-statusbar.c
nautilus-actions/nact/nact-main-window.c
nautilus-actions/nact/nact-tree-model.c
nautilus-actions/nact/nact-window.c
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]