summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarin Adler <darin@src.gnome.org>2001-04-04 01:34:10 +0000
committerDarin Adler <darin@src.gnome.org>2001-04-04 01:34:10 +0000
commitb67457434c89f1b89142f3bda2ec0c9380a9f193 (patch)
tree6581e93ba9ba9c8e583df307e3dccbfd5de864c6
parent8811aac2792724398ca7a379c17fc89ce9b66401 (diff)
downloadnautilus-b67457434c89f1b89142f3bda2ec0c9380a9f193.tar.gz
Use nautilus_view_standard_main to simplify and remove code.
* components/notes/nautilus-notes.c: (do_destroy), (notes_get_indicator_image), (make_notes_view), (main): Use nautilus_view_standard_main to simplify and remove code. * libnautilus-extensions/nautilus-global-preferences.c: (global_preferences_populate_pane): Code had N_() wrapped around an empty string. That's a no-no. Calling _("") on empty string gives you the complete translator info, which must be avoided.
-rw-r--r--ChangeLog11
-rw-r--r--components/notes/nautilus-notes.c112
-rw-r--r--libnautilus-extensions/nautilus-global-preferences.c16
-rw-r--r--libnautilus-private/nautilus-global-preferences.c16
4 files changed, 64 insertions, 91 deletions
diff --git a/ChangeLog b/ChangeLog
index abd50cd15..ba81b392c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2001-04-03 Darin Adler <darin@eazel.com>
+
+ * components/notes/nautilus-notes.c: (do_destroy),
+ (notes_get_indicator_image), (make_notes_view), (main):
+ Use nautilus_view_standard_main to simplify and remove code.
+
+ * libnautilus-extensions/nautilus-global-preferences.c:
+ (global_preferences_populate_pane): Code had N_() wrapped around
+ an empty string. That's a no-no. Calling _("") on empty string
+ gives you the complete translator info, which must be avoided.
+
2001-04-03 Ramiro Estrugo <ramiro@eazel.com>
* Makefile.am:
diff --git a/components/notes/nautilus-notes.c b/components/notes/nautilus-notes.c
index beeb376d0..bb0dd67da 100644
--- a/components/notes/nautilus-notes.c
+++ b/components/notes/nautilus-notes.c
@@ -23,23 +23,25 @@
*
*/
-/* annotation metaview - allows you to annotate a directory or file */
+/* notes sidebar panel -- allows editing per-directory notes */
#include <config.h>
-#include <bonobo/bonobo-generic-factory.h>
-#include <bonobo/bonobo-main.h>
-#include <ctype.h>
-#include <gnome.h>
-#include <libgnomevfs/gnome-vfs.h>
#include <eel/eel-background.h>
#include <eel/eel-debug.h>
-#include <libnautilus-extensions/nautilus-file.h>
-#include <libnautilus-extensions/nautilus-file-attributes.h>
-#include <libnautilus-extensions/nautilus-metadata.h>
-#include <libnautilus-extensions/nautilus-font-factory.h>
#include <eel/eel-gtk-extensions.h>
#include <eel/eel-string.h>
+#include <gtk/gtkmain.h>
+#include <gtk/gtktext.h>
+#include <gtk/gtkvbox.h>
+#include <libgnome/gnome-defs.h>
+#include <libgnome/gnome-i18n.h>
+#include <libnautilus-extensions/nautilus-file-attributes.h>
+#include <libnautilus-extensions/nautilus-file.h>
+#include <libnautilus-extensions/nautilus-font-factory.h>
+#include <libnautilus-extensions/nautilus-metadata.h>
+#include <libnautilus/nautilus-clipboard.h>
+#include <libnautilus/nautilus-view-standard-main.h>
/* FIXME bugzilla.eazel.com 4436:
* Undo not working in notes-view.
@@ -47,13 +49,16 @@
#if 0
#include <libnautilus-extensions/nautilus-undo-signal-handlers.h>
#endif
-#include <libnautilus/libnautilus.h>
-#include <libnautilus/nautilus-clipboard.h>
-#include <liboaf/liboaf.h>
-#include <limits.h>
#define NOTES_DEFAULT_BACKGROUND_COLOR "rgb:FFFF/FFFF/BBBB"
+#define SAVE_TIMEOUT (3 * 1000)
+
+/* property bag getting and setting routines */
+enum {
+ TAB_IMAGE,
+};
+
typedef struct {
NautilusView *view;
BonoboPropertyBag *property_bag;
@@ -61,21 +66,13 @@ typedef struct {
char *uri;
NautilusFile *file;
guint save_timeout_id;
- char* previous_saved_text;
+ char *previous_saved_text;
} Notes;
-static void notes_save_metainfo (Notes *notes);
-static char* notes_get_indicator_image (const char *notes_text);
-static void notify_listeners_if_changed (Notes *notes, char *new_notes);
-
-static int notes_object_count = 0;
-
-#define SAVE_TIMEOUT (3 * 1000)
-
-/* property bag getting and setting routines */
-enum {
- TAB_IMAGE,
-};
+static void notes_save_metainfo (Notes *notes);
+static char *notes_get_indicator_image (const char *notes_text);
+static void notify_listeners_if_changed (Notes *notes,
+ char *new_notes);
static void
get_bonobo_properties (BonoboPropertyBag *bag,
@@ -324,7 +321,7 @@ on_changed (GtkEditable *editable, Notes *notes)
{
schedule_save (notes);
}
-
+
static void
do_destroy (GtkObject *obj, Notes *notes)
{
@@ -343,33 +340,25 @@ do_destroy (GtkObject *obj, Notes *notes)
g_free (notes->uri);
g_free (notes->previous_saved_text);
g_free (notes);
-
- notes_object_count--;
- if (notes_object_count <= 0) {
- gtk_main_quit();
- }
}
static char *
notes_get_indicator_image (const char *notes_text)
{
- if (notes_text != NULL && strlen (notes_text) > 0) {
+ if (notes_text != NULL && notes_text[0] != '\0') {
return g_strdup ("note-indicator.png");
}
-
return NULL;
}
-static BonoboObject *
-make_notes_view (BonoboGenericFactory *Factory, const char *iid, gpointer closure)
+static NautilusView *
+make_notes_view (const char *iid, gpointer callback_data)
{
GtkWidget *vbox;
Notes *notes;
EelBackground *background;
GdkFont *font;
- g_return_val_if_fail (strcmp (iid, "OAFIID:nautilus_notes_view:7f04c3cb-df79-4b9a-a577-38b19ccd4185") == 0, NULL);
-
notes = g_new0 (Notes, 1);
notes->uri = g_strdup ("");
@@ -407,7 +396,6 @@ make_notes_view (BonoboGenericFactory *Factory, const char *iid, gpointer closur
bonobo_property_bag_add (notes->property_bag, "tab_image", TAB_IMAGE, BONOBO_ARG_STRING, NULL,
"image indicating that a note is present", 0);
- notes_object_count++;
/* handle events */
gtk_signal_connect (GTK_OBJECT (notes->view), "load_location",
@@ -427,16 +415,12 @@ make_notes_view (BonoboGenericFactory *Factory, const char *iid, gpointer closur
nautilus_undo_editable_set_undo_key (GTK_EDITABLE (notes->note_text_field), TRUE);
#endif
- return BONOBO_OBJECT (notes->view);
+ return notes->view;
}
int
main(int argc, char *argv[])
{
- BonoboGenericFactory *factory;
- CORBA_ORB orb;
- char *registration_id;
-
/* Make criticals and warnings stop in the debugger if NAUTILUS_DEBUG is set.
* Unfortunately, this has to be done explicitly for each domain.
*/
@@ -451,36 +435,10 @@ main(int argc, char *argv[])
textdomain (PACKAGE);
#endif
- /* Disable session manager connection */
- gnome_client_disable_master_connection ();
-
- /* initialize CORBA and Bonobo */
- gnomelib_register_popt_table (oaf_popt_options, oaf_get_popt_table_name ());
- orb = oaf_init (argc, argv);
-
- gnome_init ("nautilus-notes", VERSION,
- argc, argv);
- gdk_rgb_init ();
-
- bonobo_init (orb, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL);
-
- /* initialize gnome-vfs, etc */
- g_thread_init (NULL);
- gnome_vfs_init ();
-
- registration_id = oaf_make_registration_id ("OAFIID:nautilus_notes_view_factory:4b39e388-3ca2-4d68-9f3d-c137ee62d5b0",
- g_getenv ("DISPLAY"));
-
- factory = bonobo_generic_factory_new_multi
- (registration_id,
- make_notes_view, NULL);
-
- g_free (registration_id);
-
- do {
- bonobo_main();
- } while (notes_object_count > 0);
-
- gnome_vfs_shutdown ();
- return EXIT_SUCCESS;
+ return nautilus_view_standard_main ("nautilus-notes", VERSION,
+ argc, argv,
+ "OAFIID:nautilus_notes_view_factory:4b39e388-3ca2-4d68-9f3d-c137ee62d5b0",
+ "OAFIID:nautilus_notes_view:7f04c3cb-df79-4b9a-a577-38b19ccd4185",
+ make_notes_view,
+ NULL);
}
diff --git a/libnautilus-extensions/nautilus-global-preferences.c b/libnautilus-extensions/nautilus-global-preferences.c
index 115b79e42..3a4846427 100644
--- a/libnautilus-extensions/nautilus-global-preferences.c
+++ b/libnautilus-extensions/nautilus-global-preferences.c
@@ -851,7 +851,7 @@ static PreferenceDialogItem navigation_items[] = {
static PreferenceDialogItem tradeoffs_items[] = {
{ N_("Show Text in Icons"),
NAUTILUS_PREFERENCES_SHOW_TEXT_IN_ICONS,
- N_(""),
+ NULL,
NAUTILUS_PREFERENCE_ITEM_SHORT_ENUM,
NULL,
0,
@@ -859,7 +859,7 @@ static PreferenceDialogItem tradeoffs_items[] = {
},
{ N_("Show Count of Items in Folders"),
NAUTILUS_PREFERENCES_SHOW_DIRECTORY_ITEM_COUNTS,
- N_(""),
+ NULL,
NAUTILUS_PREFERENCE_ITEM_SHORT_ENUM,
NULL,
0,
@@ -867,7 +867,7 @@ static PreferenceDialogItem tradeoffs_items[] = {
},
{ N_("Show Thumbnails for Image Files"),
NAUTILUS_PREFERENCES_SHOW_IMAGE_FILE_THUMBNAILS,
- N_(""),
+ NULL,
NAUTILUS_PREFERENCE_ITEM_SHORT_ENUM,
NULL,
0,
@@ -885,7 +885,7 @@ static PreferenceDialogItem tradeoffs_items[] = {
},
{ N_("Preview Sound Files"),
NAUTILUS_PREFERENCES_PREVIEW_SOUND,
- N_(""),
+ NULL,
NAUTILUS_PREFERENCE_ITEM_SHORT_ENUM,
NULL,
0,
@@ -895,7 +895,7 @@ static PreferenceDialogItem tradeoffs_items[] = {
/* FIXME bugzilla.eazel.com 2560: This title phrase needs improvement. */
{ N_("Make Folder Appearance Details Public"),
NAUTILUS_PREFERENCES_USE_PUBLIC_METADATA,
- N_(""),
+ NULL,
NAUTILUS_PREFERENCE_ITEM_SHORT_ENUM,
NULL,
0,
@@ -1392,8 +1392,10 @@ global_preferences_populate_pane (NautilusPreferencesBox *preference_box,
group_index = start_group_index +
eel_string_list_get_index_for_string (group_names, preference_dialog_item[i].group_name);
- nautilus_preferences_set_description (preference_dialog_item[i].preference_name,
- _(preference_dialog_item[i].preference_description));
+ if (preference_dialog_item[i].preference_description != NULL) {
+ nautilus_preferences_set_description (preference_dialog_item[i].preference_name,
+ _(preference_dialog_item[i].preference_description));
+ }
enumeration_values = preference_dialog_item[i].enumeration_values;
while (enumeration_values != NULL && enumeration_values->stored_value != NULL) {
diff --git a/libnautilus-private/nautilus-global-preferences.c b/libnautilus-private/nautilus-global-preferences.c
index 115b79e42..3a4846427 100644
--- a/libnautilus-private/nautilus-global-preferences.c
+++ b/libnautilus-private/nautilus-global-preferences.c
@@ -851,7 +851,7 @@ static PreferenceDialogItem navigation_items[] = {
static PreferenceDialogItem tradeoffs_items[] = {
{ N_("Show Text in Icons"),
NAUTILUS_PREFERENCES_SHOW_TEXT_IN_ICONS,
- N_(""),
+ NULL,
NAUTILUS_PREFERENCE_ITEM_SHORT_ENUM,
NULL,
0,
@@ -859,7 +859,7 @@ static PreferenceDialogItem tradeoffs_items[] = {
},
{ N_("Show Count of Items in Folders"),
NAUTILUS_PREFERENCES_SHOW_DIRECTORY_ITEM_COUNTS,
- N_(""),
+ NULL,
NAUTILUS_PREFERENCE_ITEM_SHORT_ENUM,
NULL,
0,
@@ -867,7 +867,7 @@ static PreferenceDialogItem tradeoffs_items[] = {
},
{ N_("Show Thumbnails for Image Files"),
NAUTILUS_PREFERENCES_SHOW_IMAGE_FILE_THUMBNAILS,
- N_(""),
+ NULL,
NAUTILUS_PREFERENCE_ITEM_SHORT_ENUM,
NULL,
0,
@@ -885,7 +885,7 @@ static PreferenceDialogItem tradeoffs_items[] = {
},
{ N_("Preview Sound Files"),
NAUTILUS_PREFERENCES_PREVIEW_SOUND,
- N_(""),
+ NULL,
NAUTILUS_PREFERENCE_ITEM_SHORT_ENUM,
NULL,
0,
@@ -895,7 +895,7 @@ static PreferenceDialogItem tradeoffs_items[] = {
/* FIXME bugzilla.eazel.com 2560: This title phrase needs improvement. */
{ N_("Make Folder Appearance Details Public"),
NAUTILUS_PREFERENCES_USE_PUBLIC_METADATA,
- N_(""),
+ NULL,
NAUTILUS_PREFERENCE_ITEM_SHORT_ENUM,
NULL,
0,
@@ -1392,8 +1392,10 @@ global_preferences_populate_pane (NautilusPreferencesBox *preference_box,
group_index = start_group_index +
eel_string_list_get_index_for_string (group_names, preference_dialog_item[i].group_name);
- nautilus_preferences_set_description (preference_dialog_item[i].preference_name,
- _(preference_dialog_item[i].preference_description));
+ if (preference_dialog_item[i].preference_description != NULL) {
+ nautilus_preferences_set_description (preference_dialog_item[i].preference_name,
+ _(preference_dialog_item[i].preference_description));
+ }
enumeration_values = preference_dialog_item[i].enumeration_values;
while (enumeration_values != NULL && enumeration_values->stored_value != NULL) {