mirror of
https://gitlab.gnome.org/GNOME/nautilus
synced 2024-11-05 16:04:31 +00:00
3104ed53fd
change viewer) Now the "View as" choices, including "View as...", appear at the bottom of the View menu as well as in the location bar. * libnautilus-extensions/nautilus-bonobo-extensions.h: * libnautilus-extensions/nautilus-bonobo-extensions.c: (add_numbered_menu_item_internal): Handle radio item case; change signature to support this. (nautilus_bonobo_add_numbered_menu_item), (nautilus_bonobo_add_numbered_toggle_menu_item): Updated for change to add_numbered_menu_item_internal. (nautilus_bonobo_add_numbered_radio_menu_item): New function, just like its fellows but creates a one-of-many menu item. (nautilus_bonobo_get_numbered_menu_item_index_from_command), (nautilus_bonobo_get_numbered_menu_item_container_path_from_command): New functions that return info given one of the numbered-menu-item generated commands. Useful for callbacks when all you have in hand is the command itself. * src/nautilus-shell-ui.xml: Add "View as" command; add placeholders and separators and "View as" menu item to View menu. Also removed pixmap from Close Window menu item because it was silly to have a pixmap on exactly one item in the File menu. * src/nautilus-window-manage-views.c: Took "static" off of nautilus_window_content_matches_iid so I could make it public and use it in nautilus-window.c. * src/nautilus-window-private.h: Added fields to Details struct and prototypes for functions needed by View As stuff. * src/nautilus-window-menus.c: (view_menu_view_as_callback): New callback function used by "View as" verb. (nautilus_window_initialize_menus_part_1): Wire up "View as" verb; register for Bonobo UI events to catch radio items being selected. * src/nautilus-window.c: (set_dummy_initial_view_as_menu): Changed "View as ..." to "View as...", which matches the new name of "View as Other..." (free_stored_viewers): New function, frees and nulls out the view identifiers stored in the Details struct for the "View as" menus. (nautilus_window_destroy): Call free_stored_viewers. (activate_nth_short_list_item): New function, switches viewers by viewer index. (activate_extra_viewer): New function, switches to sometimes- present extra viewer (used when current viewer isn't in short list). (handle_view_as_item_from_bonobo_menu): If item whose state has changed is a "View as" item, dispatch accordingly. (nautilus_window_handle_ui_event_callback): Call handle_view_as_item_from_bonobo_menu if UI event was state changing to TRUE. (view_as_menu_switch_views_callback), (create_view_as_menu_item): Changed to store viewer index and whether viewer is "extra viewer" rather than storing NautilusViewIdentifier. This is used for option menu in location bar and now closely matches the mechanism used for the View menu. (add_view_as_bonobo_menu_item): New function used by View menu View As items. (replace_extra_viewer_in_view_as_menus), (nautilus_window_synch_view_as_menus): (load_view_as_menus_callback): Renamed and cleaned up to separate information gathering from widget updating; now handle View As items in View menu also. (chose_component_callback): Added FIXME for pre-existing bug 8000. (nautilus_window_show_view_as_dialog): New function, extracted from view_as_menu_choose_view_callback. (view_as_menu_choose_view_callback): Now calls extracted function. (refresh_stored_viewers): New function, updates the list of viewers stored in the Details struct.
142 lines
8.6 KiB
C
142 lines
8.6 KiB
C
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
|
|
|
|
/* nautilus-bonobo-extensions.h - interface for new functions that conceptually
|
|
belong in bonobo. Perhaps some of these will be
|
|
actually rolled into bonobo someday.
|
|
|
|
Copyright (C) 2000 Eazel, Inc.
|
|
|
|
The Gnome Library is free software; you can redistribute it and/or
|
|
modify it under the terms of the GNU Library General Public License as
|
|
published by the Free Software Foundation; either version 2 of the
|
|
License, or (at your option) any later version.
|
|
|
|
The Gnome Library 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
|
|
Library General Public License for more details.
|
|
|
|
You should have received a copy of the GNU Library General Public
|
|
License along with the Gnome Library; see the file COPYING.LIB. If not,
|
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
Boston, MA 02111-1307, USA.
|
|
|
|
Author: John Sullivan <sullivan@eazel.com>
|
|
*/
|
|
|
|
#ifndef NAUTILUS_BONOBO_EXTENSIONS_H
|
|
#define NAUTILUS_BONOBO_EXTENSIONS_H
|
|
|
|
#include <bonobo/bonobo-ui-component.h>
|
|
#include <bonobo/bonobo-xobject.h>
|
|
#include <gdk-pixbuf/gdk-pixbuf.h>
|
|
|
|
typedef struct NautilusBonoboActivationHandle NautilusBonoboActivationHandle;
|
|
|
|
typedef void (*NautilusBonoboActivationCallback) (NautilusBonoboActivationHandle *handle,
|
|
Bonobo_Unknown activated_object,
|
|
gpointer callback_data);
|
|
|
|
void nautilus_bonobo_set_accelerator (BonoboUIComponent *ui,
|
|
const char *path,
|
|
const char *accelerator);
|
|
char * nautilus_bonobo_get_label (BonoboUIComponent *ui,
|
|
const char *path);
|
|
void nautilus_bonobo_set_label (BonoboUIComponent *ui,
|
|
const char *path,
|
|
const char *label);
|
|
void nautilus_bonobo_set_tip (BonoboUIComponent *ui,
|
|
const char *path,
|
|
const char *tip);
|
|
void nautilus_bonobo_set_sensitive (BonoboUIComponent *ui,
|
|
const char *path,
|
|
gboolean sensitive);
|
|
void nautilus_bonobo_set_toggle_state (BonoboUIComponent *ui,
|
|
const char *path,
|
|
gboolean state);
|
|
void nautilus_bonobo_set_hidden (BonoboUIComponent *ui,
|
|
const char *path,
|
|
gboolean hidden);
|
|
gboolean nautilus_bonobo_get_hidden (BonoboUIComponent *ui,
|
|
const char *path);
|
|
void nautilus_bonobo_add_numbered_menu_item (BonoboUIComponent *ui,
|
|
const char *container_path,
|
|
guint index,
|
|
const char *label,
|
|
GdkPixbuf *pixbuf);
|
|
void nautilus_bonobo_add_numbered_toggle_menu_item (BonoboUIComponent *ui,
|
|
const char *container_path,
|
|
guint index,
|
|
const char *label);
|
|
void nautilus_bonobo_add_numbered_radio_menu_item (BonoboUIComponent *ui,
|
|
const char *container_path,
|
|
guint index,
|
|
const char *label,
|
|
const char *radio_group_name);
|
|
char * nautilus_bonobo_get_numbered_menu_item_command (BonoboUIComponent *ui,
|
|
const char *container_path,
|
|
guint index);
|
|
char * nautilus_bonobo_get_numbered_menu_item_path (BonoboUIComponent *ui,
|
|
const char *container_path,
|
|
guint index);
|
|
guint nautilus_bonobo_get_numbered_menu_item_index_from_command
|
|
(const char *command);
|
|
char * nautilus_bonobo_get_numbered_menu_item_container_path_from_command
|
|
(const char *command);
|
|
void nautilus_bonobo_add_submenu (BonoboUIComponent *ui,
|
|
const char *container_path,
|
|
const char *label);
|
|
void nautilus_bonobo_add_menu_separator (BonoboUIComponent *ui,
|
|
const char *path);
|
|
void nautilus_bonobo_remove_menu_items_and_commands (BonoboUIComponent *ui,
|
|
const char *container_path);
|
|
void nautilus_bonobo_set_label_for_menu_item_and_command (BonoboUIComponent *ui,
|
|
const char *menu_item_path,
|
|
const char *command_path,
|
|
const char *label_with_underscore);
|
|
void nautilus_bonobo_set_icon (BonoboUIComponent *ui,
|
|
const char *path,
|
|
const char *icon_relative_path);
|
|
|
|
NautilusBonoboActivationHandle *nautilus_bonobo_activate_from_id (const char *iid,
|
|
NautilusBonoboActivationCallback callback,
|
|
gpointer callback_data);
|
|
void nautilus_bonobo_activate_cancel (NautilusBonoboActivationHandle *handle);
|
|
|
|
|
|
/* This macro is a copy of BONOBO_X_TYPE_FUNC_FULL (from bonobo-xobject.h)
|
|
* with the addition of support for the parent_class which is defined by
|
|
* EEL_DEFINE_CLASS_BOILERPLATE and used by EEL_CALL_PARENT.
|
|
*
|
|
* Note: the argument order matches BONOBO_X_TYPE_FUNC_FULL which is different
|
|
* than EEL_DEFINE_CLASS_BOILERPLATE.
|
|
*/
|
|
#define NAUTILUS_BONOBO_X_BOILERPLATE(class_name, corba_name, parent, prefix) \
|
|
static gpointer parent_class; /* Nautilus change */ \
|
|
GtkType \
|
|
prefix##_get_type (void) \
|
|
{ \
|
|
GtkType ptype; \
|
|
static GtkType type = 0; \
|
|
\
|
|
if (type == 0) { \
|
|
static GtkTypeInfo info = { \
|
|
#class_name, \
|
|
sizeof (class_name), \
|
|
sizeof (class_name##Class), \
|
|
(GtkClassInitFunc)prefix##_class_init, \
|
|
(GtkObjectInitFunc)prefix##_init, \
|
|
NULL, NULL, (GtkClassInitFunc) NULL \
|
|
}; \
|
|
ptype = (parent); \
|
|
type = bonobo_x_type_unique (ptype, \
|
|
POA_##corba_name##__init, POA_##corba_name##__fini, \
|
|
GTK_STRUCT_OFFSET (class_name##Class, epv), \
|
|
&info); \
|
|
parent_class = gtk_type_class (ptype); /* Nautilus change */ \
|
|
} \
|
|
return type; \
|
|
}
|
|
|
|
|
|
#endif /* NAUTILUS_BONOBO_EXTENSIONS_H */
|