+2005-05-09 Jim Evins <evins@snaught.com>
+
+ Replaced libbonoboui with GtkUIManager for creation of basic user interface menus
+ and toolbars.
+
+ * configure.in:
+ * glabels.spec.in:
+ Removed dependencies on libbonoboui.
+ * data/Makefile.am:
+ * data/ui/Makefile.am:
+ * data/ui/glabels-ui.xml:
+ Removed data/ui directory.
+ * data/glade/Makefile.am:
+ * data/property-bar.glade:
+ Added glade description of property-bar for new libglade implementation
+ of glUIPropertyBar.
+ * src/Makefile.am:
+ * src/commands.h:
+ * src/commands.c:
+ * src/tools.h:
+ * src/tools.c:
+ * src/ui-commands.h:
+ * src/ui-commands.c:
+ Replaced commands.[ch] and tools.[ch] with the single ui-commands.[ch] module
+ since the distinction between "commands" and "tools" is no longer that clear.
+ * src/file.h:
+ * src/file.c:
+ Modified to expect glWindow instead of GtkWindow. gl_file_open_recent()
+ no longer has knowledge of eggRecent*.
+ * src/glabels.c: (main):
+ Removed libbonobo initialization and replaced bonobo_main loop with gtk_main
+ loop.
+ * src/object-editor.c: (gl_object_editor_init):
+ Make sure notebook does not respond to a "show_all" on the parent.
+ * src/recent-files/Makefile.am:
+ * src/recent-files/*.[ch]
+ Updated from latest version of libegg which now has a view based on
+ GtkUIManager. Removed unused bonobo and gtk views.
+ * src/ui-property-bar.h:
+ * src/ui-property-bar.c:
+ New implementation based on libglade.
+ * src/ui-sidebar.h:
+ * src/ui-sidebar.c:
+ Sidebar is now simply a GtkWidget and does not expect to be a part of
+ a libbonoboui interface.
+ * src/ui-util.h:
+ * src/ui-util.c:
+ * src/ui.h:
+ * src/ui.c:
+ Converted for use with GtkUIManager.
+ * src/window.h:
+ * src/window.c:
+ Now derived from GtkWindow instead of BonoboWindow and uses GtkUIManager
+ to create menus and toolbars.
+
2005-04-25 Jim Evins <evins@snaught.com>
* data/templates/misc-iso-templates.xml:
GTK_REQUIRED=2.6.0
LIBGNOME_REQUIRED=2.10.0
LIBGNOMEUI_REQUIRED=2.10.0
-LIBBONOBO_REQUIRED=2.8.0
-LIBBONOBOUI_REQUIRED=2.8.0
LIBXML_REQUIRED=2.6.0
LIBGNOMEPRINT_REQUIRED=2.10.0
LIBGNOMEPRINTUI_REQUIRED=2.10.0
AC_SUBST(GTK_REQUIRED)
AC_SUBST(LIBGNOME_REQUIRED)
AC_SUBST(LIBGNOMEUI_REQUIRED)
-AC_SUBST(LIBBONOBO_REQUIRED)
-AC_SUBST(LIBBONOBOUI_REQUIRED)
AC_SUBST(LIBXML_REQUIRED)
AC_SUBST(LIBGNOMEPRINT_REQUIRED)
AC_SUBST(LIBGNOMEPRINTUI_REQUIRED)
gtk+-2.0 >= $GTK_REQUIRED \
libgnome-2.0 >= $LIBGNOME_REQUIRED \
libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED \
-libbonobo-2.0 >= $LIBBONOBO_REQUIRED \
-libbonoboui-2.0 >= $LIBBONOBOUI_REQUIRED \
libxml-2.0 >= $LIBXML_REQUIRED \
libgnomeprint-2.2 >= $LIBGNOMEPRINT_REQUIRED \
libgnomeprintui-2.2 >= $LIBGNOMEPRINTUI_REQUIRED \
data/templates/Makefile
data/pixmaps/Makefile
data/mime/Makefile
-data/ui/Makefile
data/glade/Makefile
data/desktop/Makefile
data/dtd/Makefile
## Process this file with automake to produce Makefile.in
-SUBDIRS = desktop dtd glade man mime pixmaps templates ui
+SUBDIRS = desktop dtd glade man mime pixmaps templates
object-editor.glade \
prefs-dialog.glade \
template-designer.glade \
- merge-properties-dialog.glade
+ merge-properties-dialog.glade \
+ property-bar.glade
EXTRA_DIST = $(glade_DATA)
--- /dev/null
+<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
+<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
+
+<glade-interface>
+
+<widget class="GtkWindow" id="window1">
+ <property name="visible">True</property>
+ <property name="title" translatable="yes">window1</property>
+ <property name="type">GTK_WINDOW_TOPLEVEL</property>
+ <property name="window_position">GTK_WIN_POS_NONE</property>
+ <property name="modal">False</property>
+ <property name="resizable">True</property>
+ <property name="destroy_with_parent">False</property>
+ <property name="decorated">True</property>
+ <property name="skip_taskbar_hint">False</property>
+ <property name="skip_pager_hint">False</property>
+ <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
+ <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
+ <property name="focus_on_map">True</property>
+
+ <child>
+ <widget class="GtkToolbar" id="property_toolbar">
+ <property name="visible">True</property>
+ <property name="orientation">GTK_ORIENTATION_HORIZONTAL</property>
+ <property name="toolbar_style">GTK_TOOLBAR_ICONS</property>
+ <property name="tooltips">True</property>
+ <property name="show_arrow">False</property>
+
+ <child>
+ <widget class="GtkToolItem" id="toolitem1">
+ <property name="visible">True</property>
+ <property name="visible_horizontal">True</property>
+ <property name="visible_vertical">True</property>
+ <property name="is_important">False</property>
+
+ <child>
+ <widget class="GtkEventBox" id="eventbox1">
+ <property name="visible">True</property>
+ <property name="tooltip" translatable="yes">Font family</property>
+ <property name="visible_window">True</property>
+ <property name="above_child">False</property>
+
+ <child>
+ <widget class="GtkComboBox" id="font_family_combo">
+ <property name="visible">True</property>
+ <property name="items" translatable="yes">Font family</property>
+ <property name="add_tearoffs">False</property>
+ <property name="focus_on_click">False</property>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkToolItem" id="toolitem2">
+ <property name="visible">True</property>
+ <property name="visible_horizontal">True</property>
+ <property name="visible_vertical">True</property>
+ <property name="is_important">False</property>
+
+ <child>
+ <widget class="GtkAlignment" id="alignment1">
+ <property name="visible">True</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xscale">1</property>
+ <property name="yscale">1</property>
+ <property name="top_padding">0</property>
+ <property name="bottom_padding">0</property>
+ <property name="left_padding">6</property>
+ <property name="right_padding">0</property>
+
+ <child>
+ <widget class="GtkSpinButton" id="font_size_spin">
+ <property name="visible">True</property>
+ <property name="tooltip" translatable="yes">Font size</property>
+ <property name="can_focus">True</property>
+ <property name="climb_rate">1</property>
+ <property name="digits">0</property>
+ <property name="numeric">False</property>
+ <property name="update_policy">GTK_UPDATE_ALWAYS</property>
+ <property name="snap_to_ticks">False</property>
+ <property name="wrap">False</property>
+ <property name="adjustment">1 1 250 1 10 10</property>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkSeparatorToolItem" id="separatortoolitem1">
+ <property name="visible">True</property>
+ <property name="draw">True</property>
+ <property name="visible_horizontal">True</property>
+ <property name="visible_vertical">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkToggleToolButton" id="font_bold_toggle">
+ <property name="visible">True</property>
+ <property name="tooltip" translatable="yes">Bold</property>
+ <property name="label" translatable="yes"></property>
+ <property name="use_underline">True</property>
+ <property name="stock_id">gtk-bold</property>
+ <property name="visible_horizontal">True</property>
+ <property name="visible_vertical">True</property>
+ <property name="is_important">False</property>
+ <property name="active">False</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkToggleToolButton" id="font_italic_toggle">
+ <property name="visible">True</property>
+ <property name="tooltip" translatable="yes">Italic</property>
+ <property name="label" translatable="yes"></property>
+ <property name="use_underline">True</property>
+ <property name="stock_id">gtk-italic</property>
+ <property name="visible_horizontal">True</property>
+ <property name="visible_vertical">True</property>
+ <property name="is_important">False</property>
+ <property name="active">False</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkSeparatorToolItem" id="separatortoolitem2">
+ <property name="visible">True</property>
+ <property name="draw">True</property>
+ <property name="visible_horizontal">True</property>
+ <property name="visible_vertical">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkRadioToolButton" id="text_align_left_radio">
+ <property name="visible">True</property>
+ <property name="tooltip" translatable="yes">Left align</property>
+ <property name="label" translatable="yes"></property>
+ <property name="use_underline">True</property>
+ <property name="stock_id">gtk-justify-left</property>
+ <property name="visible_horizontal">True</property>
+ <property name="visible_vertical">True</property>
+ <property name="is_important">False</property>
+ <property name="active">False</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkRadioToolButton" id="text_align_center_radio">
+ <property name="visible">True</property>
+ <property name="tooltip" translatable="yes">Center align</property>
+ <property name="label" translatable="yes"></property>
+ <property name="use_underline">True</property>
+ <property name="stock_id">gtk-justify-center</property>
+ <property name="visible_horizontal">True</property>
+ <property name="visible_vertical">True</property>
+ <property name="is_important">False</property>
+ <property name="active">False</property>
+ <property name="group">text_align_left_radio</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkRadioToolButton" id="text_align_right_radio">
+ <property name="visible">True</property>
+ <property name="tooltip" translatable="yes">Right align</property>
+ <property name="label" translatable="yes"></property>
+ <property name="use_underline">True</property>
+ <property name="stock_id">gtk-justify-right</property>
+ <property name="visible_horizontal">True</property>
+ <property name="visible_vertical">True</property>
+ <property name="is_important">False</property>
+ <property name="active">False</property>
+ <property name="group">text_align_left_radio</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkSeparatorToolItem" id="separatortoolitem3">
+ <property name="visible">True</property>
+ <property name="draw">True</property>
+ <property name="visible_horizontal">True</property>
+ <property name="visible_vertical">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkToolItem" id="toolitem3">
+ <property name="visible">True</property>
+ <property name="visible_horizontal">True</property>
+ <property name="visible_vertical">True</property>
+ <property name="is_important">False</property>
+
+ <child>
+ <widget class="GtkEventBox" id="eventbox2">
+ <property name="visible">True</property>
+ <property name="tooltip" translatable="yes">Text Color</property>
+ <property name="visible_window">True</property>
+ <property name="above_child">False</property>
+
+ <child>
+ <widget class="Custom" id="text_color_combo">
+ <property name="visible">True</property>
+ <property name="tooltip" translatable="yes">Text color</property>
+ <property name="creation_function">gl_ui_property_bar_construct_color_combo</property>
+ <property name="int1">0</property>
+ <property name="int2">0</property>
+ <property name="last_modification_time">Sun, 01 May 2005 15:21:11 GMT</property>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkToolItem" id="toolitem4">
+ <property name="visible">True</property>
+ <property name="visible_horizontal">True</property>
+ <property name="visible_vertical">True</property>
+ <property name="is_important">False</property>
+
+ <child>
+ <widget class="GtkEventBox" id="eventbox3">
+ <property name="visible">True</property>
+ <property name="tooltip" translatable="yes">Fill color</property>
+ <property name="visible_window">True</property>
+ <property name="above_child">False</property>
+
+ <child>
+ <widget class="Custom" id="fill_color_combo">
+ <property name="visible">True</property>
+ <property name="tooltip" translatable="yes">Fill color</property>
+ <property name="creation_function">gl_ui_property_bar_construct_color_combo</property>
+ <property name="int1">1</property>
+ <property name="int2">0</property>
+ <property name="last_modification_time">Sun, 01 May 2005 15:21:18 GMT</property>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkToolItem" id="toolitem5">
+ <property name="visible">True</property>
+ <property name="visible_horizontal">True</property>
+ <property name="visible_vertical">True</property>
+ <property name="is_important">False</property>
+
+ <child>
+ <widget class="GtkEventBox" id="eventbox4">
+ <property name="visible">True</property>
+ <property name="tooltip" translatable="yes">Line color</property>
+ <property name="visible_window">True</property>
+ <property name="above_child">False</property>
+
+ <child>
+ <widget class="Custom" id="line_color_combo">
+ <property name="visible">True</property>
+ <property name="tooltip" translatable="yes">Line color</property>
+ <property name="creation_function">gl_ui_property_bar_construct_color_combo</property>
+ <property name="int1">2</property>
+ <property name="int2">0</property>
+ <property name="last_modification_time">Sun, 01 May 2005 15:21:24 GMT</property>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkSeparatorToolItem" id="separatortoolitem4">
+ <property name="visible">True</property>
+ <property name="draw">True</property>
+ <property name="visible_horizontal">True</property>
+ <property name="visible_vertical">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkToolItem" id="toolitem6">
+ <property name="visible">True</property>
+ <property name="visible_horizontal">True</property>
+ <property name="visible_vertical">True</property>
+ <property name="is_important">False</property>
+
+ <child>
+ <widget class="GtkSpinButton" id="line_width_spin">
+ <property name="visible">True</property>
+ <property name="tooltip" translatable="yes">Line width</property>
+ <property name="can_focus">True</property>
+ <property name="climb_rate">1</property>
+ <property name="digits">2</property>
+ <property name="numeric">False</property>
+ <property name="update_policy">GTK_UPDATE_ALWAYS</property>
+ <property name="snap_to_ticks">False</property>
+ <property name="wrap">False</property>
+ <property name="adjustment">1 0.25 4 0.25 1 1</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">False</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+</widget>
+
+</glade-interface>
+++ /dev/null
-## Process this file with automake to produce Makefile.in
-
-uidir = $(datadir)/glabels/ui/
-
-ui_DATA = glabels-ui.xml
-
-EXTRA_DIST = $(ui_DATA)
+++ /dev/null
-<Root>
-
-
-
- <commands>
-
- <cmd name="FileNew"
- _label="New"
- _tip="Create a new document"
- pixtype="stock" pixname="gtk-new"
- accel="*Control*N"
- />
-
- <cmd name="FileProperties"
- _label="Properties"
- _tip="Modify document properties"
- pixtype="stock" pixname="gtk-properties"
- />
-
- <cmd name="FileOpen"
- _label="Open"
- _tip="Open a file"
- pixtype="stock" pixname="gtk-open"
- accel="*Control*O"
- />
-
- <cmd name="FileSave"
- _label="Save"
- _tip="Save the current file"
- pixtype="stock" pixname="gtk-save"
- accel="*Control*S"
- />
-
- <cmd name="FileSaveAs"
- _label="Save As"
- _tip="Save the current file with a different name"
- pixtype="stock" pixname="gtk-save-as"
- accel="*Shift**Control*S"
- />
-
- <cmd name="FileTemplateDesigner"
- _label="Template Designer"
- _tip="Create a custom template"
- />
-
- <cmd name="FilePrint"
- _label="Print"
- _tip="Print the current file"
- pixtype="stock" pixname="gtk-print"
- accel="*Control*P"
- />
-
- <cmd name="FileClose"
- _label="Close"
- _tip="Close the current file"
- pixtype="stock" pixname="gtk-close"
- accel="*Alt*F4"
- />
-
- <cmd name="FileExit"
- _label="Quit"
- _tip="Quit the program"
- pixtype="stock" pixname="gtk-quit"
- accel="*Control*Q"
- />
-
- <cmd name="EditUndo"
- _label="Undo"
- _tip="Undo the last action"
- pixtype="stock" pixname="gtk-undo"
- accel="*Control*Z"
- />
-
- <cmd name="EditRedo"
- _label="Redo"
- _tip="Redo the undone action"
- pixtype="stock" pixname="gtk-redo"
- accel="*Shift**Control*Z"
- />
-
- <cmd name="EditCut"
- _label="Cut"
- _tip="Cut the selection"
- pixtype="stock" pixname="gtk-cut"
- accel="*Control*X"
- />
-
- <cmd name="EditCopy"
- _label="Copy"
- _tip="Copy the selection"
- pixtype="stock" pixname="gtk-copy"
- accel="*Control*c"
- />
-
- <cmd name="EditPaste"
- _label="Paste"
- _tip="Paste the clipboard"
- pixtype="stock" pixname="gtk-paste"
- accel="*Control*v"
- />
-
- <cmd name="EditDelete"
- _label="Delete"
- _tip="Delete the selected objects"
- />
-
- <cmd name="EditSelectAll"
- _label="Select All"
- _tip="Select all objects"
- accel="*Control*A"
- />
-
- <cmd name="EditUnSelectAll"
- _label="Un-select All"
- _tip="Remove all selections"
- />
-
- <cmd name="ViewMainToolbar"
- _label="_Main Toolbar"
- _tip="Change the visibility of the main toolbar in the current window"
- type="toggle" state="0"
- />
-
- <cmd name="MainToolbarSystem"
- id="MainToolbarSystem"
- _label="_Desktop Default"
- _tip="Set main toolbar button style according to desktop default"
- type="radio" group="main_buttons" state="1"
- />
-
- <cmd name="MainToolbarIcon"
- id="MainToolbarIcon"
- _label="_Icon"
- _tip="Only show icons in the main toolbar"
- type="radio" group="main_buttons"
- />
-
- <cmd name="MainToolbarIconText"
- id="MainToolbarIconText"
- _label="Icon and _Text"
- _tip="Show both icons and texts in the main toolbar"
- type="radio" group="main_buttons"
- />
-
- <cmd name="MainToolbarTooltips"
- id="MainToolbarTooltips"
- _label="Show _Tooltips"
- _tip="Show tooltips in the main toolbar"
- type="toggle" state="1"
- />
-
- <cmd name="ViewDrawingToolbar"
- _label="_Drawing Toolbar"
- _tip="Change the visibility of the drawing toolbar in the current window"
- type="toggle" state="0"
- />
-
- <cmd name="DrawingToolbarTooltips"
- id="DrawingToolbarTooltips"
- _label="Show _Tooltips"
- _tip="Show tooltips in the drawing toolbar"
- type="toggle" state="1"
- />
-
- <cmd name="ViewPropertyToolbar"
- _label="_Property Toolbar"
- _tip="Change the visibility of the property toolbar in the current window"
- type="toggle" state="0"
- />
-
- <cmd name="PropertyToolbarTooltips"
- id="PropertyToolbarTooltips"
- _label="Show _Tooltips"
- _tip="Show tooltips in the property toolbar"
- type="toggle" state="1"
- />
-
- <cmd name="ViewGrid"
- _label="_Grid"
- _tip="Change the visibility of the grid in the current window"
- type="toggle" state="1"
- />
-
- <cmd name="ViewMarkup"
- _label="Markup"
- _tip="Change the visibility of markup lines in the current window"
- type="toggle" state="1"
- />
-
- <cmd name="SettingsPreferences"
- _label="Preferences"
- _tip="Configure the application"
- pixtype="stock" pixname="gtk-preferences"
- />
-
- <cmd name="ToolsArrow"
- _tip="Select, move and modify objects"
- pixtype="stock" pixname="gl_stock_arrow"
- />
-
- <cmd name="ToolsText"
- _tip="Create text object"
- pixtype="stock" pixname="gl_stock_text"
- />
-
- <cmd name="ToolsLine"
- _tip="Create line object"
- pixtype="stock" pixname="gl_stock_line"
- />
-
- <cmd name="ToolsBox"
- _tip="Create box/rectangle object"
- pixtype="stock" pixname="gl_stock_box"
- />
-
- <cmd name="ToolsEllipse"
- _tip="Create ellipse/circle object"
- pixtype="stock" pixname="gl_stock_ellipse"
- />
-
- <cmd name="ToolsImage"
- _tip="Create image object"
- pixtype="stock" pixname="gl_stock_image"
- />
-
- <cmd name="ToolsBarcode"
- _tip="Create barcode object"
- pixtype="stock" pixname="gl_stock_barcode"
- />
-
- <cmd name="ToolsZoomIn"
- _tip="Increase magnification"
- pixtype="stock" pixname="gtk-zoom-in"
- />
-
- <cmd name="ToolsZoomOut"
- _tip="Decrease magnification"
- pixtype="stock" pixname="gtk-zoom-out"
- />
-
- <cmd name="ToolsZoom1to1"
- _tip="Restore scale to 100%"
- pixtype="stock" pixname="gtk-zoom-100"
- />
-
- <cmd name="ToolsZoomToFit"
- _tip="Zoom to fit window"
- pixtype="stock" pixname="gtk-zoom-fit"
- />
-
- <cmd name="ToolsMergeProperties"
- _tip="Edit merge properties"
- pixtype="stock" pixname="gl_stock_merge"
- />
-
- <cmd name="ToolsRaiseObjects"
- _tip="Raise object to top"
- pixtype="stock" pixname="gl_stock_order_top"
- />
-
- <cmd name="ToolsLowerObjects"
- _tip="Lower object to bottom"
- pixtype="stock" pixname="gl_stock_order_bottom"
- />
-
- <cmd name="ToolsRotateLeft"
- _tip="Rotate object 90 counter-clockwise"
- pixtype="stock" pixname="gl_stock_rotate_left"
- />
-
- <cmd name="ToolsRotateRight"
- _tip="Rotate object 90 clockwise"
- pixtype="stock" pixname="gl_stock_rotate_right"
- />
-
- <cmd name="ToolsFlipHorizontal"
- _tip="Flip object horizontally"
- pixtype="stock" pixname="gl_stock_flip_horiz"
- />
-
- <cmd name="ToolsFlipVertical"
- _tip="Flip object vertically"
- pixtype="stock" pixname="gl_stock_flip_vert"
- />
-
- <cmd name="ToolsAlignLeft"
- _tip="Align objects to left edges"
- pixtype="stock" pixname="gl_stock_align_left"
- />
-
- <cmd name="ToolsAlignHCenter"
- _tip="Align objects to horizontal centers"
- pixtype="stock" pixname="gl_stock_align_hcenter"
- />
-
- <cmd name="ToolsAlignRight"
- _tip="Align objects to right edges"
- pixtype="stock" pixname="gl_stock_align_right"
- />
-
- <cmd name="ToolsAlignTop"
- _tip="Align objects to tops"
- pixtype="stock" pixname="gl_stock_align_top"
- />
-
- <cmd name="ToolsAlignVCenter"
- _tip="Align objects to vertical centers"
- pixtype="stock" pixname="gl_stock_align_vcenter"
- />
-
- <cmd name="ToolsAlignBottom"
- _tip="Align objects to bottoms"
- pixtype="stock" pixname="gl_stock_align_bottom"
- />
-
- <cmd name="ToolsCenterHorizontal"
- _tip="Center objects to horizontal label center"
- pixtype="stock" pixname="gl_stock_center_horiz"
- />
-
- <cmd name="ToolsCenterVertical"
- _tip="Center objects to vertical label center"
- pixtype="stock" pixname="gl_stock_center_vert"
- />
-
- <cmd name="PropFontName"
- _tip="Font name"
- />
-
- <cmd name="PropFontSize"
- _tip="Font size"
- />
-
- <cmd name="PropFontBold"
- _tip="Bold" type="toggle"
- />
-
- <cmd name="PropFontItalic"
- _tip="Italic"
- type="toggle"
- />
-
- <cmd name="PropTextAlignLeft"
- _tip="Left align"
- type="toggle" state="0"
- />
-
- <cmd name="PropTextAlignCenter"
- _tip="Center align"
- type="toggle" state="0"
- />
-
- <cmd name="PropTextAlignRight"
- _tip="Right align"
- type="toggle" state="0"
- />
-
- <cmd name="PropTextColor"
- _tip="Text color"
- />
-
- <cmd name="PropFillColor"
- _tip="Fill color"
- />
-
- <cmd name="PropLineColor"
- _tip="Line color"
- />
-
- <cmd name="PropLineWidth"
- _tip="Line width"
- />
-
- <cmd name="PropertyEditor"
- />
-
- <cmd name="HelpContents"
- _label="Contents"
- _tip="Open the glabels manual"
- pixtype="stock" pixname="gtk-help"
- accel="F1"
- />
-
- <cmd name="About"
- _label="About..."
- _tip="About glabels"
- pixtype="stock" pixname="About"
- />
-
- <cmd name="BonoboCustomize"
- _label="Customize"
- _tip="Customize toolbars"
- />
-
- <cmd name="BonoboUIDump"
- _label="Dump XML"
- _tip="Dump the UI Xml description"
- hidden="0"
- />
-
- </commands>
-
-
-
- <menu>
-
-
- <submenu name="File"
- _label="_File"
- hidden="0"
- >
-
- <menuitem name="FileNew"
- verb=""
- _label="_New"
- />
-
- <menuitem name="FileOpen"
- verb=""
- _label="_Open..."
- />
-
- <submenu name="Recents"
- _label="Recent _Files"
- />
-
- <separator />
-
- <menuitem name="FileSave"
- verb=""
- _label="_Save"
- />
-
- <menuitem name="FileSaveAs"
- verb=""
- _label="Save _As..."
- />
-
- <separator />
-
- <menuitem name="FilePrint"
- verb=""
- _label="_Print..."
- />
-
- <separator />
-
- <menuitem name="FileProperties"
- verb=""
- _label="Proper_ties..."
- />
-
- <menuitem name="FileTemplateDesigner"
- verb=""
- _label="Template _Designer..."
- />
-
- <separator />
-
- <menuitem name="FileClose"
- verb=""
- _label="_Close"
- />
-
- <menuitem name="FileExit"
- verb=""
- _label="_Quit"
- />
-
- </submenu>
-
-
- <submenu name="Edit"
- _label="_Edit"
- hidden="0"
- >
-
- <menuitem name="EditCut"
- verb=""
- _label="Cu_t"
- />
-
- <menuitem name="EditCopy"
- verb=""
- _label="_Copy"
- />
-
- <menuitem name="EditPaste"
- verb=""
- _label="_Paste"
- />
-
- <menuitem name="EditDelete"
- verb=""
- _label="_Delete"
- />
-
- <separator />
-
- <menuitem name="EditSelectAll"
- verb=""
- _label="Select _All"
- />
-
- <menuitem name="EditUnSelectAll"
- verb=""
- _label="U_n-select All"
- />
-
- <separator />
-
- <menuitem name="SettingsPreferences"
- verb=""
- _label="Pr_eferences..."
- />
-
- </submenu>
-
-
- <submenu name="View"
- _label="_View"
- hidden="0"
- >
-
- <menuitem name="ViewMainToolbar"
- id="ViewMainToolbar"
- verb=""
- />
-
- <menuitem name="ViewDrawingToolbar"
- id="ViewDrawingToolbar"
- verb=""
- />
-
- <menuitem name="ViewPropertyToolbar"
- id="ViewPropertyToolbar"
- verb=""
- />
-
- <separator />
-
- <submenu name="CustomizeMainToolbar"
- _label="Customize Main Toolbar"
- >
-
- <menuitem name="MainToolbarSystem"
- verb=""
- />
-
- <menuitem name="MainToolbarIcon"
- verb=""
- />
-
- <menuitem name="MainToolbarIconText"
- verb=""
- />
-
- <separator />
-
- <menuitem name="MainToolbarTooltips"
- verb=""
- />
-
- </submenu>
-
- <submenu name="CustomizeDrawingToolbar"
- _label="Customize Drawing Toolbar"
- >
-
- <menuitem name="DrawingToolbarTooltips"
- verb=""
- />
-
- </submenu>
-
- <submenu name="CustomizePropertyToolbar"
- _label="Customize Property Toolbar"
- >
-
- <menuitem name="PropertyToolbarTooltips"
- verb=""
- />
-
- </submenu>
-
- <separator />
-
- <menuitem name="ViewGrid"
- id="ViewGrid"
- verb=""
- _label="_Grid"
- />
-
- <menuitem name="ViewMarkup"
- id="ViewMarkup"
- verb=""
- _label="M_arkup"
- />
-
- <separator />
-
- <menuitem name="ToolsZoomIn"
- verb=""
- _label="Zoom _In"
- />
-
- <menuitem name="ToolsZoomOut"
- verb=""
- _label="Zoom _Out"
- />
-
- <menuitem name="ToolsZoom1to1"
- verb=""
- _label="Zoom _1:1"
- />
-
- <menuitem name="ToolsZoomToFit"
- verb=""
- _label="Zoom to _fit"
- />
-
- </submenu>
-
-
- <submenu name="Objects"
- _label="_Objects"
- hidden="0"
- >
-
- <menuitem name="ToolsArrow"
- verb=""
- _label="_Select Mode"
- />
-
- <submenu name="CreateObjects"
- _label="_Create Object"
- >
-
- <menuitem name="ToolsText"
- verb=""
- _label="_Text"
- />
-
- <menuitem name="ToolsBox"
- verb=""
- _label="_Box"
- />
-
- <menuitem name="ToolsLine"
- verb=""
- _label="_Line"
- />
-
- <menuitem name="ToolsEllipse"
- verb=""
- _label="_Ellipse"
- />
-
- <menuitem name="ToolsImage"
- verb=""
- _label="_Image"
- />
-
- <menuitem name="ToolsBarcode"
- verb=""
- _label="Bar_code"
- />
-
- </submenu>
-
- <separator />
-
- <submenu name="Order"
- _label="_Order"
- >
-
- <menuitem name="ToolsRaiseObjects"
- verb=""
- _label="Bring to _Front"
- />
-
- <menuitem name="ToolsLowerObjects"
- verb=""
- _label="Send to _Back"
- />
-
- </submenu>
-
- <submenu name="RotateFlip"
- _label="_Rotate/Flip"
- >
-
- <menuitem name="ToolsRotateLeft"
- verb=""
- _label="Rotate _Left"
- />
-
- <menuitem name="ToolsRotateRight"
- verb=""
- _label="Rotate _Right"
- />
-
- <menuitem name="ToolsFlipHorizontal"
- verb=""
- _label="Flip _Horizontally"
- />
-
- <menuitem name="ToolsFlipVertical"
- verb=""
- _label="Flip _Vertically"
- />
-
- </submenu>
-
- <submenu name="AlignHoriz"
- _label="Align _Horizontal"
- >
-
- <menuitem name="ToolsAlignLeft"
- verb=""
- _label="_Lefts"
- />
-
- <menuitem name="ToolsAlignHCenter"
- verb=""
- _label="_Centers"
- />
-
- <menuitem name="ToolsAlignRight"
- verb=""
- _label="_Rights"
- />
-
- <menuitem name="ToolsCenterHorizontal"
- verb=""
- _label="Label Ce_nter"
- />
-
- </submenu>
-
- <submenu name="AlignVert"
- _label="Align _Vertical"
- >
-
- <menuitem name="ToolsAlignTop"
- verb=""
- _label="_Tops"
- />
-
- <menuitem name="ToolsAlignVCenter"
- verb=""
- _label="_Centers"
- />
-
- <menuitem name="ToolsAlignBottom"
- verb=""
- _label="_Bottoms"
- />
-
- <menuitem name="ToolsCenterVertical"
- verb=""
- _label="Label Ce_nter"
- />
-
- </submenu>
-
- <separator />
-
- <menuitem name="ToolsMergeProperties"
- verb=""
- _label="_Merge Properties..."
- />
-
- </submenu>
-
-
- <submenu name="Help"
- _label="_Help"
- hidden="0"
- >
-
- <menuitem name="HelpContents"
- verb=""
- _label="_Contents"
- />
-
- <menuitem name="About"
- verb=""
- _label="_About..."
- />
-
- </submenu>
-
-
- <submenu name="Debug"
- _label="_Debug"
- hidden="1"
- >
-
- <menuitem name="BonoboUIDump"
- verb=""
- />
-
- <menuitem name="BonoboCustomize"
- verb=""
- label="Customize"
- />
-
- </submenu>
-
-
- </menu>
-
-
-
-
- <dockitem name="MainToolbar"
- _tip="Main toolbar"
- config="0"
- behavior="exclusive"
- in_new_band="1"
- >
-
- <toolitem name="FileNew"
- verb=""
- />
-
- <toolitem name="FileOpen"
- verb=""
- />
-
- <toolitem name="FileSave"
- verb=""
- />
-
- <separator />
-
- <toolitem name="FilePrint"
- verb=""
- />
-
- <separator />
-
- <toolitem name="EditCut"
- verb=""
- />
-
- <toolitem name="EditCopy"
- verb=""
- />
-
- <toolitem name="EditPaste"
- verb=""
- />
-
- </dockitem>
-
-
-
-
- <dockitem name="DrawingToolbar"
- _tip="Drawing toolbar"
- config="0"
- behavior="exclusive"
- in_new_band="1"
- band_num="2"
- look="icon"
- >
-
- <toolitem name="ToolsArrow"
- verb=""
- />
-
- <separator />
-
- <toolitem name="ToolsText"
- verb=""
- />
-
- <toolitem name="ToolsBox"
- verb=""
- />
-
- <toolitem name="ToolsLine"
- verb=""
- />
-
- <toolitem name="ToolsEllipse"
- verb=""
- />
-
- <toolitem name="ToolsImage"
- verb=""
- />
-
- <toolitem name="ToolsBarcode"
- verb=""
- />
-
- <separator />
-
- <toolitem name="ToolsZoomIn"
- verb=""
- />
-
- <toolitem name="ToolsZoomOut"
- verb=""
- />
-
- <toolitem name="ToolsZoom1to1"
- verb=""
- />
-
- <toolitem name="ToolsZoomToFit"
- verb=""
- />
-
- <separator />
-
- <toolitem name="ToolsMergeProperties"
- verb=""
- />
-
- </dockitem>
-
-
-
-
- <dockitem name="PropertyToolbar"
- _tip="Property toolbar"
- config="0"
- behavior="exclusive,never vertical"
- in_new_band="1"
- placement="bottom"
- look="icon"
- >
-
- <control name="PropFontName"
- verb=""
- _tip="Font selector"
- />
-
- <control name="PropFontSize"
- verb=""
- _tip="Font size"
- />
-
- <separator />
-
- <toolitem name="PropFontBold"
- verb=""
- _tip="Bold"
- pixtype="stock" pixname="gtk-bold"
- />
-
- <toolitem name="PropFontItalic"
- verb=""
- _tip="Italic"
- pixtype="stock" pixname="gtk-italic"
- />
-
- <separator />
-
- <toolitem name="PropTextAlignLeft"
- verb=""
- _tip="Left align"
- pixtype="stock" pixname="gtk-justify-left"
- />
-
- <toolitem name="PropTextAlignCenter"
- verb=""
- _tip="Center align"
- pixtype="stock" pixname="gtk-justify-center"
- />
-
- <toolitem name="PropTextAlignRight"
- verb=""
- _tip="Right align"
- pixtype="stock" pixname="gtk-justify-right"
- />
-
- <separator />
-
- <control name="PropTextColor"
- verb=""
- _tip="Text color"
- />
-
- <control name="PropFillColor"
- verb=""
- _tip="Fill color"
- />
-
- <control name="PropLineColor"
- verb=""
- _tip="Line color"
- />
-
- <separator />
-
- <control name="PropLineWidth"
- verb=""
- _tip="Line width"
- />
-
- </dockitem>
-
-
- <dockitem name="PropertySidebar"
- _tip="Object property editor"
- config="0"
- behavior="exclusive,never horizontal"
- in_new_band="1"
- placement="right"
- >
-
- <control name="PropertyEditor"
- verb=""
- />
-
- </dockitem>
-
-
-
-
-
- <status resize_grip="1">
-
- <item name="main" />
-
- <control name="Zoom" />
-
- <control name="Cursor" />
-
- </status>
-
-
-
-
-</Root>
BuildRequires: gtk2-devel >= @GTK_REQUIRED@
BuildRequires: libxml2-devel >= @LIBXML_REQUIRED@
BuildRequires: libgnomeui-devel >= @LIBGNOMEUI_REQUIRED@
-BuildRequires: libbonoboui-devel >= @LIBBONOBOUI_REQUIRED@
BuildRequires: libgnomecanvas-devel >= @LIBGNOMECANVAS_REQUIRED@
BuildRequires: libgnomeprintui22-devel >= @LIBGNOMEPRINT_REQUIRED@
BuildRequires: libglade2-devel >= @LIBGLADE_REQUIRED@
Requires: gtk2 >= @GTK_REQUIRED@
Requires: libxml2 >= @LIBXML_REQUIRED@
Requires: libgnomeui >= @LIBGNOMEUI_REQUIRED@
-Requires: libbonoboui >= @LIBBONOBOUI_REQUIRED@
Requires: libgnomecanvas >= @LIBGNOMECANVAS_REQUIRED@
Requires: libgnomeprintui22 >= @LIBGNOMEPRINT_REQUIRED@
Requires: libglade2 >= @LIBGLADE_REQUIRED@
stock.h \
ui.h \
ui.c \
+ ui-util.h \
+ ui-util.c \
+ ui-commands.h \
+ ui-commands.c \
ui-property-bar.h \
ui-property-bar.c \
ui-sidebar.h \
ui-sidebar.c \
- ui-util.h \
- ui-util.c \
- commands.h \
- commands.c \
file.h \
file.c \
recent.h \
recent.c \
- tools.h \
- tools.c \
prefs.c \
prefs.h \
prefs-model.c \
+++ /dev/null
-/*
- * (GLABELS) Label and Business Card Creation program for GNOME
- *
- * commands.c: GLabels commands module
- *
- * Copyright (C) 2001-2003 Jim Evins <evins@snaught.com>.
- *
- * 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.
- *
- * 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
- */
-
-#include <config.h>
-
-#include "commands.h"
-
-#include <glib/gi18n.h>
-#include <gtk/gtkwindow.h>
-#include <gtk/gtkaboutdialog.h>
-#include <libgnome/gnome-help.h>
-#include <libgnome/gnome-url.h>
-
-#include "view.h"
-#include "file.h"
-#include "template-designer.h"
-#include "print-dialog.h"
-#include "prefs.h"
-#include "prefs-dialog.h"
-#include "debug.h"
-
-#define LOGO_PIXMAP gnome_program_locate_file (NULL,\
- GNOME_FILE_DOMAIN_APP_PIXMAP,\
- "glabels/glabels-about-logo.png",\
- FALSE, NULL)
-
-\f
-/****************************************************************************/
-/* File->New command. */
-/****************************************************************************/
-void
-gl_cmd_file_new (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname)
-{
- glWindow *window = GL_WINDOW (user_data);
-
- gl_debug (DEBUG_COMMANDS, "");
-
- gl_file_new (GTK_WINDOW(window));
-}
-
-/****************************************************************************/
-/* File->Properties command. */
-/****************************************************************************/
-void
-gl_cmd_file_properties (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname)
-{
- glWindow *window = GL_WINDOW (user_data);
-
- gl_debug (DEBUG_COMMANDS, "");
-
- gl_file_properties (GL_VIEW(window->view)->label, GTK_WINDOW(window));
-}
-
-/****************************************************************************/
-/* File->Template Designer command. */
-/****************************************************************************/
-void
-gl_cmd_file_template_designer (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname)
-{
- glWindow *window = GL_WINDOW (user_data);
- GtkWidget *dialog;
-
- gl_debug (DEBUG_COMMANDS, "");
-
- g_return_if_fail (window && GL_IS_WINDOW(window));
-
- dialog = gl_template_designer_new (GTK_WINDOW(window));
-
- gtk_widget_show (dialog);
-}
-
-/****************************************************************************/
-/* File->Open command. */
-/****************************************************************************/
-void
-gl_cmd_file_open (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname)
-{
- glWindow *window = GL_WINDOW (user_data);
-
- gl_debug (DEBUG_COMMANDS, "");
-
- g_return_if_fail (window && GL_IS_WINDOW(window));
-
- gl_file_open (GTK_WINDOW(window));
-}
-
-/****************************************************************************/
-/* File->Save command. */
-/****************************************************************************/
-void
-gl_cmd_file_save (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname)
-{
- glWindow *window = GL_WINDOW (user_data);
-
- gl_debug (DEBUG_COMMANDS, "");
-
- g_return_if_fail (window && GL_IS_WINDOW(window));
-
- gl_file_save (GL_VIEW(window->view)->label, GTK_WINDOW(window));
-}
-
-/****************************************************************************/
-/* File->Save_as command. */
-/****************************************************************************/
-void
-gl_cmd_file_save_as (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname)
-{
- glWindow *window = GL_WINDOW (user_data);
-
- gl_debug (DEBUG_COMMANDS, "");
-
- g_return_if_fail (window && GL_IS_WINDOW(window));
-
- gl_file_save_as (GL_VIEW(window->view)->label, GTK_WINDOW(window));
-}
-
-/****************************************************************************/
-/* File->Print command. */
-/****************************************************************************/
-void
-gl_cmd_file_print (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname)
-{
- glWindow *window = GL_WINDOW (user_data);
-
- gl_debug (DEBUG_COMMANDS, "");
-
- g_return_if_fail (window && GL_IS_WINDOW(window));
-
- if (GL_VIEW(window->view)->print_dialog) {
-
- gtk_window_present (GTK_WINDOW(GL_VIEW(window->view)->print_dialog));
-
- } else {
-
- GL_VIEW(window->view)->print_dialog =
- g_object_ref (
- gl_print_dialog_new (GL_VIEW(window->view)->label,
- BONOBO_WINDOW(window)) );
-
- gtk_widget_show (GL_VIEW(window->view)->print_dialog);
- }
-
-}
-
-/****************************************************************************/
-/* File->Close command. */
-/****************************************************************************/
-void
-gl_cmd_file_close (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname)
-{
- glWindow *window = GL_WINDOW (user_data);
-
- gl_debug (DEBUG_COMMANDS, "");
-
- g_return_if_fail (window && GL_IS_WINDOW(window));
-
- gl_file_close (window);
-}
-
-/****************************************************************************/
-/* File->Exit command. */
-/****************************************************************************/
-void
-gl_cmd_file_exit (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname)
-{
- glWindow *window = GL_WINDOW (user_data);
-
- gl_debug (DEBUG_COMMANDS, "");
-
- g_return_if_fail (window && GL_IS_WINDOW(window));
-
- gl_file_exit ();
-}
-
-
-/****************************************************************************/
-/* Edit->Cut command. */
-/****************************************************************************/
-void
-gl_cmd_edit_cut (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname)
-{
- glWindow *window = GL_WINDOW (user_data);
-
- gl_debug (DEBUG_COMMANDS, "");
-
- g_return_if_fail (window && GL_IS_WINDOW(window));
-
- gl_view_cut (GL_VIEW(window->view));
-}
-
-/****************************************************************************/
-/* Edit->Copy command. */
-/****************************************************************************/
-void
-gl_cmd_edit_copy (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname)
-{
- glWindow *window = GL_WINDOW (user_data);
-
- gl_debug (DEBUG_COMMANDS, "");
-
- g_return_if_fail (window && GL_IS_WINDOW(window));
-
- gl_view_copy (GL_VIEW(window->view));
-}
-
-/****************************************************************************/
-/* Edit->Paste command. */
-/****************************************************************************/
-void
-gl_cmd_edit_paste (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname)
-{
- glWindow *window = GL_WINDOW (user_data);
-
- gl_debug (DEBUG_COMMANDS, "");
-
- g_return_if_fail (window && GL_IS_WINDOW(window));
-
- gl_view_paste (GL_VIEW(window->view));
-}
-
-
-/****************************************************************************/
-/* Edit->Delete command. */
-/****************************************************************************/
-void
-gl_cmd_edit_delete (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname)
-{
- glWindow *window = GL_WINDOW (user_data);
-
- gl_debug (DEBUG_COMMANDS, "");
-
- g_return_if_fail (window && GL_IS_WINDOW(window));
-
- gl_view_delete_selection (GL_VIEW(window->view));
-}
-
-
-/****************************************************************************/
-/* Edit->Select_all command. */
-/****************************************************************************/
-void
-gl_cmd_edit_select_all (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname)
-{
- glWindow *window = GL_WINDOW (user_data);
-
- gl_debug (DEBUG_COMMANDS, "");
-
- g_return_if_fail (window && GL_IS_WINDOW(window));
-
- gl_view_select_all (GL_VIEW(window->view));
-}
-
-/****************************************************************************/
-/* Edit->Select_all command. */
-/****************************************************************************/
-void
-gl_cmd_edit_unselect_all (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname)
-{
- glWindow *window = GL_WINDOW (user_data);
-
- gl_debug (DEBUG_COMMANDS, "");
-
- g_return_if_fail (window && GL_IS_WINDOW(window));
-
- gl_view_unselect_all (GL_VIEW(window->view));
-}
-
-/****************************************************************************/
-/* Settings->Preferences command. */
-/****************************************************************************/
-void
-gl_cmd_settings_preferences (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname)
-{
- glWindow *window = GL_WINDOW (user_data);
- static GtkWidget *dlg = NULL;
-
- gl_debug (DEBUG_COMMANDS, "");
-
- g_return_if_fail (window && GL_IS_WINDOW(window));
-
- if (dlg != NULL)
- {
- gtk_window_present (GTK_WINDOW (dlg));
- gtk_window_set_transient_for (GTK_WINDOW (dlg),
- GTK_WINDOW(window));
-
- return;
- }
-
- dlg = gl_prefs_dialog_new (GTK_WINDOW(window));
-
- g_signal_connect (G_OBJECT (dlg), "destroy",
- G_CALLBACK (gtk_widget_destroyed), &dlg);
-
- gtk_widget_show (dlg);
-}
-
-/****************************************************************************/
-/* Help->Contents command. */
-/****************************************************************************/
-void
-gl_cmd_help_contents (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname)
-{
- glWindow *window = GL_WINDOW (user_data);
- GError *error = NULL;
-
- gl_debug (DEBUG_COMMANDS, "");
-
- g_return_if_fail (window && GL_IS_WINDOW(window));
-
- gnome_help_display_with_doc_id (NULL, NULL, "glabels.xml", NULL, &error);
-
- if (error != NULL)
- {
- g_warning (error->message);
-
- g_error_free (error);
- }
-}
-
-/*--------------------------------------------------------------------------*/
-/* Private: URL handler. */
-/*--------------------------------------------------------------------------*/
-static void
-activate_url (GtkAboutDialog *about, const gchar *url, gpointer data)
-{
- gnome_url_show (url, NULL);
-}
-
-
-/****************************************************************************/
-/* Help->About command. */
-/****************************************************************************/
-void
-gl_cmd_help_about (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname)
-{
- glWindow *window = GL_WINDOW (user_data);
-
- static GtkWidget *about = NULL;
-
- GdkPixbuf *pixbuf = NULL;
-
- const gchar *authors[] = {
- "Jim Evins <evins@snaught.com>",
- " ",
- "Frederic Ruaudel <grumz@users.sf.net>",
- "Wayne Schuller <k_wayne@linuxpower.org>",
- "Emmanuel Pacaud <emmanuel.pacaud@univ-poitiers.fr>",
- " ",
- _("See the file AUTHORS for additional credits,"),
- _("or visit http://glabels.sourceforge.net/"),
- NULL
- };
-
- const gchar *artists[] = {
- "Nestor Di <nestordi@usuarios.retecal.es>",
- "Jim Evins <evins@snaught.com>",
- NULL
- };
-
- const gchar *copy_text = "Copyright \xc2\xa9 2001-2005 Jim Evins";
-
- const gchar *about_text = _("A label and business card creation program.\n");
-
- const gchar *url = "http://glabels.sourceforge.net";
-
- const gchar *translator_credits = _("translator-credits");
-
- const gchar *license = _(
- "Glabels is free software; you can redistribute it and/or modify it\n"
- "under the terms of the GNU General Public License as published by\n"
- "the Free Software Foundation; either version 2 of the License, or\n"
- "(at your option) any later version.\n" "\n"
- "This program is distributed in the hope that it will be useful, but\n"
- "WITHOUT ANY WARRANTY; without even the implied warranty of\n"
- "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See\n"
- "the GNU General Public License for more details.\n");
-
- gl_debug (DEBUG_COMMANDS, "");
-
- g_return_if_fail (window && GL_IS_WINDOW(window));
-
- if (about != NULL)
- {
- gtk_window_set_transient_for (GTK_WINDOW (about),
- GTK_WINDOW (window));
- gtk_window_present (GTK_WINDOW (about));
- return;
- }
-
- pixbuf = gdk_pixbuf_new_from_file ( LOGO_PIXMAP, NULL);
-
- gtk_about_dialog_set_url_hook (activate_url, NULL, NULL);
-
- about = gtk_about_dialog_new ();
- gtk_about_dialog_set_name (GTK_ABOUT_DIALOG(about), _("glabels"));
- gtk_about_dialog_set_version (GTK_ABOUT_DIALOG(about), VERSION);
- gtk_about_dialog_set_copyright (GTK_ABOUT_DIALOG(about), copy_text);
- gtk_about_dialog_set_comments (GTK_ABOUT_DIALOG(about), about_text);
- gtk_about_dialog_set_website (GTK_ABOUT_DIALOG(about), url);
- gtk_about_dialog_set_logo (GTK_ABOUT_DIALOG(about), pixbuf);
-
- gtk_about_dialog_set_authors (GTK_ABOUT_DIALOG(about), authors);
- gtk_about_dialog_set_artists (GTK_ABOUT_DIALOG(about), artists);
- gtk_about_dialog_set_translator_credits (GTK_ABOUT_DIALOG(about),
- translator_credits);
- gtk_about_dialog_set_license (GTK_ABOUT_DIALOG(about), license);
-
- gtk_window_set_destroy_with_parent (GTK_WINDOW (about), TRUE);
-
- g_signal_connect (G_OBJECT (about), "response",
- G_CALLBACK (gtk_widget_destroy), NULL);
- g_signal_connect (G_OBJECT (about), "destroy",
- G_CALLBACK (gtk_widget_destroyed), &about);
-
- gtk_window_set_transient_for (GTK_WINDOW (about),
- GTK_WINDOW (window));
-
- gtk_window_present (GTK_WINDOW (about));
-
- if (pixbuf != NULL)
- g_object_unref (pixbuf);
-
-
-}
-
-
+++ /dev/null
-/*
- * (GLABELS) Label and Business Card Creation program for GNOME
- *
- * commands.h: GLabels commands module header file
- *
- * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>.
- *
- * 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.
- *
- * 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
- */
-
-#ifndef __COMMANDS_H__
-#define __COMMANDS_H__
-
-#include <bonobo/bonobo-ui-component.h>
-
-G_BEGIN_DECLS
-
-void gl_cmd_file_new (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname);
-
-void gl_cmd_file_properties (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname);
-
-void gl_cmd_file_template_designer (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname);
-
-void gl_cmd_file_open (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname);
-
-void gl_cmd_file_save (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname);
-
-void gl_cmd_file_save_as (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname);
-
-void gl_cmd_file_print (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname);
-
-void gl_cmd_file_print_preview (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname);
-
-void gl_cmd_file_close (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname);
-
-void gl_cmd_file_exit (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname);
-
-
-void gl_cmd_edit_undo (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname);
-
-void gl_cmd_edit_redo (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname);
-
-void gl_cmd_edit_cut (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname);
-
-void gl_cmd_edit_copy (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname);
-
-void gl_cmd_edit_paste (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname);
-
-void gl_cmd_edit_delete (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname);
-
-void gl_cmd_edit_select_all (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname);
-
-void gl_cmd_edit_unselect_all (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname);
-
-
-void gl_cmd_settings_preferences (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname);
-
-
-void gl_cmd_help_contents (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname);
-
-void gl_cmd_help_about (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname);
-G_END_DECLS
-
-#endif /* __COMMANDS_H__ */
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
/*
* (GLABELS) Label and Business Card Creation program for GNOME
*
static void open_response (GtkDialog *chooser,
gint response,
- GtkWindow *window);
+ glWindow *window);
static void save_as_response (GtkDialog *chooser,
gint response,
glLabel *label);
/* "New" menu callback. */
/*****************************************************************************/
void
-gl_file_new (GtkWindow *window)
+gl_file_new (glWindow *window)
{
GtkWidget *dlg;
g_return_if_fail (window != NULL);
dlg = gl_hig_dialog_new_with_buttons (_("New Label or Card"),
- window,
+ GTK_WINDOW (window),
GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OK, GTK_RESPONSE_OK,
/*****************************************************************************/
void
gl_file_properties (glLabel *label,
- GtkWindow *window)
+ glWindow *window)
{
GtkWidget *dlg;
g_return_if_fail (window && GTK_IS_WINDOW (window));
dlg = gl_hig_dialog_new_with_buttons (_("Label properties"),
- window,
+ GTK_WINDOW (window),
GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OK, GTK_RESPONSE_OK,
/* "Open" menu callback. */
/*****************************************************************************/
void
-gl_file_open (GtkWindow *window)
+gl_file_open (glWindow *window)
{
GtkWidget *chooser;
GtkFileFilter *filter;
g_return_if_fail (window != NULL);
chooser = gtk_file_chooser_dialog_new ("Open label",
- window,
+ GTK_WINDOW (window),
GTK_FILE_CHOOSER_ACTION_OPEN,
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
static void
open_response (GtkDialog *chooser,
gint response,
- GtkWindow *window)
+ glWindow *window)
{
gchar *raw_filename;
gchar *filename;
/*****************************************************************************/
/* "Open recent" menu callback. */
/*****************************************************************************/
-gboolean
-gl_file_open_recent (EggRecentView *view,
- EggRecentItem *item,
- GtkWindow *window)
+void
+gl_file_open_recent (const gchar *filename,
+ glWindow *window)
{
- gboolean result = FALSE;
- gchar *filename;
-
gl_debug (DEBUG_FILE, "");
- filename = gl_recent_get_filename (item);
-
if (filename) {
gl_debug (DEBUG_FILE, "open recent: %s", filename);
- result = gl_file_open_real (filename, window);
- g_free (filename);
+ gl_file_open_real (filename, window);
}
-
- return result;
}
/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/
gboolean
gl_file_open_real (const gchar *filename,
- GtkWindow *window)
+ glWindow *window)
{
gchar *abs_filename;
glLabel *label;
primary_msg = g_strdup_printf (_("Could not open file \"%s\""),
filename);
- dlg = gl_hig_alert_new (window,
+ dlg = gl_hig_alert_new (GTK_WINDOW (window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
/*****************************************************************************/
gboolean
gl_file_save (glLabel *label,
- GtkWindow *window)
+ glWindow *window)
{
glXMLLabelStatus status;
GError *error = NULL;
primary_msg = g_strdup_printf (_("Could not save file \"%s\""),
filename);
- dialog = gl_hig_alert_new (window,
+ dialog = gl_hig_alert_new (GTK_WINDOW (window),
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
/*****************************************************************************/
gboolean
gl_file_save_as (glLabel *label,
- GtkWindow *window)
+ glWindow *window)
{
GtkWidget *chooser;
GtkFileFilter *filter;
gl_debug (DEBUG_FILE, "START");
g_return_val_if_fail (label && GL_IS_LABEL(label), FALSE);
- g_return_val_if_fail (window && GTK_IS_WINDOW(window), FALSE);
+ g_return_val_if_fail (window && GL_IS_WINDOW(window), FALSE);
name = gl_label_get_short_name (label);
title = g_strdup_printf (_("Save \"%s\" as"), name);
g_free (name);
chooser = gtk_file_chooser_dialog_new (title,
- window,
+ GTK_WINDOW (window),
GTK_FILE_CHOOSER_ACTION_SAVE,
GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
switch (ret)
{
case GTK_RESPONSE_YES:
- close = gl_file_save (label,
- GTK_WINDOW(window));
+ close = gl_file_save (label, window);
break;
case GTK_RESPONSE_NO:
close = TRUE;
gl_debug (DEBUG_FILE, "All windows closed.");
- bonobo_main_quit ();
+ gtk_main_quit ();
}
}
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
/*
* (GLABELS) Label and Business Card Creation program for GNOME
*
#ifndef __FILE_H__
#define __FILE_H__
-#include "recent-files/egg-recent-view.h"
#include <gtk/gtkwindow.h>
#include "label.h"
G_BEGIN_DECLS
-void gl_file_new (GtkWindow *window);
+void gl_file_new (glWindow *window);
void gl_file_properties (glLabel *label,
- GtkWindow *window);
+ glWindow *window);
-void gl_file_open (GtkWindow *window);
+void gl_file_open (glWindow *window);
-gboolean gl_file_open_recent (EggRecentView *view,
- EggRecentItem *filename,
- GtkWindow *window);;
+void gl_file_open_recent (const gchar *filename,
+ glWindow *window);
gboolean gl_file_open_real (const gchar *filename,
- GtkWindow *window);
+ glWindow *window);
gboolean gl_file_save (glLabel *label,
- GtkWindow *window);
+ glWindow *window);
gboolean gl_file_save_as (glLabel *label,
- GtkWindow *window);
+ glWindow *window);
gboolean gl_file_close (glWindow *window);
-/*
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/**
* (GLABELS) Label and Business Card Creation program for GNOME
*
* glabels.c: GLabels main module
#include <libgnome/libgnome.h>
#include <libgnomeui/libgnomeui.h>
#include <libgnomeui/gnome-window-icon.h>
-#include <libbonoboui.h>
#include "splash.h"
#include "stock.h"
gl_merge_init ();
gl_recent_init ();
- if (!bonobo_ui_init ("glabels", VERSION, &argc, argv)) {
- g_error (_("Could not initialize Bonobo!\n"));
- }
-
client = gnome_master_client();
g_signal_connect (G_OBJECT (client), "save_yourself",
/* Begin main loop */
- bonobo_main();
+ gtk_main();
return 0;
}
-/*
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/**
* (GLABELS) Label and Business Card Creation program for GNOME
*
* object-editor.c: object properties editor module
/* Hide all notebook pages to start with. */
gtk_widget_hide_all (editor->priv->notebook);
+ gtk_widget_set_no_show_all (editor->priv->notebook, TRUE);
gl_debug (DEBUG_EDITOR, "END");
}
egg-recent-model.h \
egg-recent-util.c \
egg-recent-util.h \
- egg-recent-view-bonobo.c \
- egg-recent-view-bonobo.h \
egg-recent-view.c \
egg-recent-view.h \
- egg-recent-view-gtk.c \
- egg-recent-view-gtk.h
+ egg-recent-view-uimanager.c \
+ egg-recent-view-uimanager.h
noinst_LTLIBRARIES = librecent.la
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/**
+/*
* 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
item->private_data = FALSE;
item->uri = NULL;
item->mime_type = NULL;
+ item->mime_type_is_explicit = FALSE;
item->refcount = 1;
return NULL;
}
- item->mime_type = gnome_vfs_get_mime_type (item->uri);
-
- if (!item->mime_type)
- item->mime_type = g_strdup (GNOME_VFS_MIME_TYPE_UNKNOWN);
-
return item;
}
newitem->uri = g_strdup (item->uri);
if (item->mime_type)
newitem->mime_type = g_strdup (item->mime_type);
+ newitem->mime_type_is_explicit = item->mime_type_is_explicit
newitem->timestamp = item->timestamp;
newitem->private_data = item->private_data;
newitem->groups = egg_recent_item_copy_groups (item->groups);
}
*/
+static void
+egg_recent_item_update_mime_type (EggRecentItem *item)
+{
+ if (!item->mime_type_is_explicit) {
+ g_free (item->mime_type);
+ item->mime_type = NULL;
+
+ if (item->uri)
+ item->mime_type = gnome_vfs_get_mime_type (item->uri);
+
+ if (!item->mime_type)
+ item->mime_type = g_strdup (GNOME_VFS_MIME_TYPE_UNKNOWN);
+ }
+}
+
gboolean
egg_recent_item_set_uri (EggRecentItem *item, const gchar *uri)
{
string = NULL;
remainder = name;
- remaining_bytes = strlen (name);
+ remaining_bytes = name ? strlen (name) : 0;
while (remaining_bytes != 0) {
if (g_utf8_validate (remainder, remaining_bytes, &invalid))
return NULL;
uri = gnome_vfs_uri_new (item->uri);
- g_assert (uri != NULL); /* We already checked this in egg_recent_item_set_uri() */
+ if (uri == NULL)
+ return NULL;
short_name = gnome_vfs_uri_extract_short_name (uri);
valid = FALSE;
short_name = tmp;
}
- g_free (uri);
+ gnome_vfs_uri_unref (uri);
return short_name;
}
void
egg_recent_item_set_mime_type (EggRecentItem *item, const gchar *mime)
{
- item->mime_type = g_strdup (mime);
+ g_free (item->mime_type);
+ item->mime_type = NULL;
+
+ if (mime && mime[0]) {
+ item->mime_type_is_explicit = TRUE;
+ item->mime_type = g_strdup (mime);
+ } else {
+ item->mime_type_is_explicit = FALSE;
+ }
}
gchar *
-egg_recent_item_get_mime_type (const EggRecentItem *item)
+egg_recent_item_get_mime_type (EggRecentItem *item)
{
+ egg_recent_item_update_mime_type (item);
+
return g_strdup (item->mime_type);
}
GList *groups;
int refcount;
+
+ guint mime_type_is_explicit : 1;
};
GType egg_recent_item_get_type (void) G_GNUC_CONST;
gchar * egg_recent_item_get_short_name (const EggRecentItem *item);
void egg_recent_item_set_mime_type (EggRecentItem *item, const gchar *mime);
-gchar * egg_recent_item_get_mime_type (const EggRecentItem *item);
+gchar * egg_recent_item_get_mime_type (EggRecentItem *item);
void egg_recent_item_set_timestamp (EggRecentItem *item, time_t timestamp);
time_t egg_recent_item_get_timestamp (const EggRecentItem *item);
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/**
+/*
* 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
egg_recent_model_monitor (EggRecentModel *model, gboolean should_monitor)
{
if (should_monitor && model->priv->monitor == NULL) {
+ char *uri;
+
+ uri = gnome_vfs_get_uri_from_local_path (model->priv->path);
gnome_vfs_monitor_add (&model->priv->monitor,
- model->priv->path,
- GNOME_VFS_MONITOR_FILE,
- egg_recent_model_monitor_cb,
- model);
+ uri,
+ GNOME_VFS_MONITOR_FILE,
+ egg_recent_model_monitor_cb,
+ model);
+
+ g_free (uri);
/* if the above fails, don't worry about it.
* local notifications will still happen
egg_recent_model_open_file (EggRecentModel *model)
{
FILE *file;
+ mode_t prev_umask;
file = fopen (model->priv->path, "r+");
if (file == NULL) {
/* be paranoid */
- umask (077);
+ prev_umask = umask (077);
file = fopen (model->priv->path, "w+");
+ umask (prev_umask);
+
g_return_val_if_fail (file != NULL, NULL);
}
ret = TRUE;
} else {
g_warning ("Failed to lock: %s", strerror (errno));
+ fclose (file);
return FALSE;
}
}
#ifndef USE_STABLE_LIBGNOMEUI
-static GdkPixbuf *
-scale_icon (GdkPixbuf *pixbuf,
- double *scale)
-{
- guint width, height;
-
- width = gdk_pixbuf_get_width (pixbuf);
- height = gdk_pixbuf_get_height (pixbuf);
-
- width = floor (width * *scale + 0.5);
- height = floor (height * *scale + 0.5);
-
- return gdk_pixbuf_scale_simple (pixbuf, width, height, GDK_INTERP_BILINEAR);
-}
-
static GdkPixbuf *
load_icon_file (char *filename,
- guint base_size,
guint nominal_size)
{
GdkPixbuf *pixbuf, *scaled_pixbuf;
- guint width, height, size;
- double scale;
+ guint width, height;
- pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
+ pixbuf = gdk_pixbuf_new_from_file_at_size (filename, nominal_size, nominal_size, NULL);
if (pixbuf == NULL) {
return NULL;
}
- if (base_size == 0) {
- width = gdk_pixbuf_get_width (pixbuf);
- height = gdk_pixbuf_get_height (pixbuf);
- size = MAX (width, height);
- if (size > nominal_size) {
- base_size = size;
+ width = gdk_pixbuf_get_width (pixbuf);
+ height = gdk_pixbuf_get_height (pixbuf);
+ /* if the icon is larger than the nominal size, scale down */
+ if (MAX (width, height) > nominal_size) {
+ if (width > height) {
+ height = height * nominal_size / width;
+ width = nominal_size;
} else {
- /* Don't scale up small icons */
- base_size = nominal_size;
+ width = width * nominal_size / height;
+ height = nominal_size;
}
- }
-
- if (base_size != nominal_size) {
- scale = (double)nominal_size/base_size;
- scaled_pixbuf = scale_icon (pixbuf, &scale);
+ scaled_pixbuf = gdk_pixbuf_scale_simple
+ (pixbuf, width, height, GDK_INTERP_BILINEAR);
g_object_unref (pixbuf);
pixbuf = scaled_pixbuf;
}
gchar *icon;
gchar *filename;
const GnomeIconData *icon_data;
- int base_size;
GdkPixbuf *pixbuf;
icon = gnome_icon_lookup (theme, NULL, uri, NULL, NULL,
filename = gnome_icon_theme_lookup_icon (theme, icon,
size,
&icon_data,
- &base_size);
+ NULL);
g_free (icon);
if (filename == NULL) {
return NULL;
}
- pixbuf = load_icon_file (filename, base_size, size);
+ pixbuf = load_icon_file (filename, size);
g_free (filename);
+++ /dev/null
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/**
- * 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.
- *
- * 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.
- *
- * Authors:
- * James Willcox <jwillcox@cs.indiana.edu>
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <gtk/gtk.h>
-#include <libbonoboui.h>
-#include <libgnomevfs/gnome-vfs.h>
-#ifndef USE_STABLE_LIBGNOMEUI
-#include <libgnomeui/gnome-icon-theme.h>
-#endif
-#include <gconf/gconf-client.h>
-#include "egg-recent-model.h"
-#include "egg-recent-view.h"
-#include "egg-recent-view-bonobo.h"
-#include "egg-recent-util.h"
-#include "egg-recent-item.h"
-
-struct _EggRecentViewBonobo {
- GObject parent_instance; /* We emit signals */
-
- BonoboUIComponent *uic;
- gchar *path; /* The menu path where our stuff
- * will go
- */
-
- gulong changed_cb_id;
-
- gchar *uid; /* unique id used for the verb name */
-
- gboolean show_icons;
- gboolean show_numbers;
-#ifndef USE_STABLE_LIBGNOMEUI
- GnomeIconTheme *theme;
-#endif
- EggRecentViewBonoboTooltipFunc tooltip_func;
- gpointer tooltip_func_data;
-
- EggRecentModel *model;
- GConfClient *client;
- GtkIconSize icon_size;
-};
-
-
-struct _EggRecentViewBonoboMenuData {
- EggRecentViewBonobo *view;
- EggRecentItem *item;
-};
-
-typedef struct _EggRecentViewBonoboMenuData EggRecentViewBonoboMenuData;
-
-enum {
- ACTIVATE,
- LAST_SIGNAL
-};
-
-/* GObject properties */
-enum {
- PROP_BOGUS,
- PROP_UI_COMPONENT,
- PROP_MENU_PATH,
- PROP_SHOW_ICONS,
- PROP_SHOW_NUMBERS
-};
-
-static guint egg_recent_view_bonobo_signals[LAST_SIGNAL] = { 0 };
-
-static void
-egg_recent_view_bonobo_clear (EggRecentViewBonobo *view)
-{
- gint i=1;
- gboolean done=FALSE;
- EggRecentModel *model;
-
- g_return_if_fail (view->uic);
-
- model = egg_recent_view_get_model (EGG_RECENT_VIEW (view));
-
- while (!done)
- {
- gchar *verb_name = g_strdup_printf ("%s-%d", view->uid, i);
- gchar *item_path = g_strconcat (view->path, "/", verb_name, NULL);
- if (bonobo_ui_component_path_exists (view->uic, item_path, NULL))
- bonobo_ui_component_rm (view->uic, item_path, NULL);
- else
- done=TRUE;
-
- g_free (item_path);
- g_free (verb_name);
-
- i++;
- }
-}
-
-static void
-egg_recent_view_bonobo_menu_cb (BonoboUIComponent *uic, gpointer data, const char *cname)
-{
- EggRecentViewBonoboMenuData *md = (EggRecentViewBonoboMenuData *) data;
- EggRecentItem *item;
-
- g_return_if_fail (md);
- g_return_if_fail (md->item);
- g_return_if_fail (md->view);
- g_return_if_fail (EGG_IS_RECENT_VIEW_BONOBO (md->view));
-
- item = md->item;
- egg_recent_item_ref (item);
-
- g_signal_emit (G_OBJECT(md->view),
- egg_recent_view_bonobo_signals[ACTIVATE], 0,
- item);
-
- egg_recent_item_unref (item);
-}
-
-static void
-egg_recent_view_bonobo_menu_data_destroy_cb (gpointer data, GClosure *closure)
-{
- EggRecentViewBonoboMenuData *md = data;
-
- egg_recent_item_unref (md->item);
- g_free (md);
-}
-
-
-static void
-egg_recent_view_bonobo_set_list (EggRecentViewBonobo *view, GList *list)
-{
- BonoboUIComponent* ui_component;
- unsigned int i;
- gchar *label = NULL;
- gchar *verb_name = NULL;
- gchar *tip = NULL;
- gchar *escaped_name = NULL;
- gchar *item_path = NULL;
- gchar *base_uri;
- gchar *utf8_uri;
- gchar *cmd;
- gchar *xml_escaped_name;
- EggRecentViewBonoboMenuData *md;
- EggRecentModel *model;
- GClosure *closure;
-
- g_return_if_fail (view);
-
- ui_component = view->uic;
- g_return_if_fail (BONOBO_IS_UI_COMPONENT (ui_component));
-
-
- model = egg_recent_view_get_model (EGG_RECENT_VIEW (view));
-
- egg_recent_view_bonobo_clear (view);
-
-
- bonobo_ui_component_freeze (ui_component, NULL);
-
- for (i = 1; i <= g_list_length (list); ++i)
- {
- EggRecentItem *item = (EggRecentItem *)g_list_nth_data (list, i-1);
-
- utf8_uri = egg_recent_item_get_uri_for_display (item);
- if (utf8_uri == NULL)
- continue;
-
- /* this is what gets passed to our private "activate" callback */
- md = (EggRecentViewBonoboMenuData *)g_malloc (sizeof (EggRecentViewBonoboMenuData));
- md->view = view;
- md->item = item;
-
- egg_recent_item_ref (md->item);
-
- base_uri = g_path_get_basename (utf8_uri);
- xml_escaped_name = g_markup_escape_text (base_uri,
- strlen (base_uri));
-
- escaped_name = egg_recent_util_escape_underlines (xml_escaped_name);
- g_free (xml_escaped_name);
-
- tip = NULL;
- if (view->tooltip_func != NULL) {
- gchar *tmp_tip;
- tip = view->tooltip_func (item,
- view->tooltip_func_data);
- tmp_tip = g_markup_escape_text (tip, strlen (tip));
- g_free (tip);
- tip = tmp_tip;
- }
-
- if (tip == NULL)
- tip = g_strdup ("");
-
- verb_name = g_strdup_printf ("%s-%d", view->uid, i);
-
- if (view->show_icons) {
- GdkPixbuf *pixbuf;
- gchar *mime_type;
- gchar *uri;
-
- mime_type = egg_recent_item_get_mime_type (item);
- uri = egg_recent_item_get_uri (item);
-#ifndef USE_STABLE_LIBGNOMEUI
- {
- int width, height;
-
- gtk_icon_size_lookup_for_settings
- (gtk_settings_get_default (),
- view->icon_size,
- &width, &height);
- pixbuf = egg_recent_util_get_icon
- (view->theme,
- uri, mime_type,
- height);
- }
-#else
- pixbuf = NULL;
-#endif
-
-
- if (pixbuf != NULL) {
- gchar *pixbuf_xml;
-
- /* Riiiiight.... */
- pixbuf_xml = bonobo_ui_util_pixbuf_to_xml (pixbuf);
-
- cmd = g_strdup_printf ("<cmd name=\"%s\" pixtype=\"pixbuf\" pixname=\"%s\"/>", verb_name, pixbuf_xml);
-
- g_free (pixbuf_xml);
- g_object_unref (pixbuf);
- } else {
- cmd = g_strdup_printf ("<cmd name=\"%s\"/> ",
- verb_name);
- }
-
- g_free (mime_type);
- g_free (uri);
- } else
- cmd = g_strdup_printf ("<cmd name=\"%s\"/> ",
- verb_name);
- bonobo_ui_component_set_translate (ui_component, "/commands/", cmd, NULL);
-
- closure = g_cclosure_new (G_CALLBACK (egg_recent_view_bonobo_menu_cb),
- md, egg_recent_view_bonobo_menu_data_destroy_cb);
-
- bonobo_ui_component_add_verb_full (ui_component, verb_name,
- closure);
-
- if (view->show_numbers) {
- if (i < 10)
- label = g_strdup_printf ("_%d. %s", i,
- escaped_name);
- else
- label = g_strdup_printf ("%d. %s", i, escaped_name);
- } else {
- label = g_strdup (escaped_name);
- }
-
-
-
- item_path = g_strconcat (view->path, "/", verb_name, NULL);
-
- if (bonobo_ui_component_path_exists (ui_component, item_path, NULL))
- {
- bonobo_ui_component_set_prop (ui_component, item_path,
- "label", label, NULL);
-
- bonobo_ui_component_set_prop (ui_component, item_path,
- "tip", tip, NULL);
- }
- else
- {
- gchar *xml;
-
- xml = g_strdup_printf ("<menuitem name=\"%s\" "
- "verb=\"%s\""
- " _label=\"%s\" _tip=\"%s\" "
- "hidden=\"0\" />",
- verb_name, verb_name, label,
- tip);
-
- bonobo_ui_component_set_translate (ui_component, view->path, xml, NULL);
-
- g_free (xml);
- }
-
- g_free (label);
- g_free (verb_name);
- g_free (tip);
- g_free (escaped_name);
- g_free (item_path);
- g_free (utf8_uri);
- g_free (base_uri);
- g_free (cmd);
-
- }
-
-
- bonobo_ui_component_thaw (ui_component, NULL);
-}
-
-static void
-model_changed_cb (EggRecentModel *model, GList *list, EggRecentViewBonobo *view)
-{
- if (list != NULL)
- egg_recent_view_bonobo_set_list (view, list);
- else
- egg_recent_view_bonobo_clear (view);
-}
-
-
-static EggRecentModel *
-egg_recent_view_bonobo_get_model (EggRecentView *view_parent)
-{
- EggRecentViewBonobo *view;
-
- g_return_val_if_fail (view_parent, NULL);
- view = EGG_RECENT_VIEW_BONOBO (view_parent);
-
- return view->model;
-}
-
-static void
-egg_recent_view_bonobo_set_model (EggRecentView *view_parent, EggRecentModel *model)
-{
- EggRecentViewBonobo *view;
-
- g_return_if_fail (view_parent);
- view = EGG_RECENT_VIEW_BONOBO (view_parent);
-
- if (view->model)
- g_signal_handler_disconnect (G_OBJECT (view->model),
- view->changed_cb_id);
-
- view->model = model;
- g_object_ref (view->model);
- view->changed_cb_id = g_signal_connect_object (G_OBJECT (model),
- "changed",
- G_CALLBACK (model_changed_cb),
- view, 0);
-
- egg_recent_model_changed (view->model);
-}
-
-static void
-egg_recent_view_bonobo_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- EggRecentViewBonobo *view = EGG_RECENT_VIEW_BONOBO (object);
-
- switch (prop_id)
- {
- case PROP_UI_COMPONENT:
- egg_recent_view_bonobo_set_ui_component (EGG_RECENT_VIEW_BONOBO (view),
- BONOBO_UI_COMPONENT (g_value_get_object (value)));
- break;
- case PROP_MENU_PATH:
- view->path = g_strdup (g_value_get_string (value));
- break;
- case PROP_SHOW_ICONS:
- egg_recent_view_bonobo_show_icons (view,
- g_value_get_boolean (value));
- default:
- case PROP_SHOW_NUMBERS:
- egg_recent_view_bonobo_show_numbers (view,
- g_value_get_boolean (value));
- break;
- break;
- }
-}
-
-static void
-egg_recent_view_bonobo_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- EggRecentViewBonobo *view = EGG_RECENT_VIEW_BONOBO (object);
-
- switch (prop_id)
- {
- case PROP_UI_COMPONENT:
- g_value_set_pointer (value, view->uic);
- break;
- case PROP_MENU_PATH:
- g_value_set_string (value, g_strdup (view->path));
- break;
- case PROP_SHOW_ICONS:
- g_value_set_boolean (value, view->show_icons);
- break;
- case PROP_SHOW_NUMBERS:
- g_value_set_boolean (value, view->show_numbers);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- }
-}
-
-static void
-egg_recent_view_bonobo_finalize (GObject *object)
-{
- EggRecentViewBonobo *view = EGG_RECENT_VIEW_BONOBO (object);
-
- g_free (view->path);
- g_free (view->uid);
-
- g_object_unref (view->model);
- g_object_unref (view->uic);
-#ifndef USE_STABLE_LIBGNOMEUI
- g_object_unref (view->theme);
-#endif
- g_object_unref (view->client);
-}
-
-static void
-egg_recent_view_bonobo_class_init (EggRecentViewBonoboClass * klass)
-{
- GObjectClass *object_class;
-
-
- object_class = G_OBJECT_CLASS (klass);
-
- object_class->set_property = egg_recent_view_bonobo_set_property;
- object_class->get_property = egg_recent_view_bonobo_get_property;
- object_class->finalize = egg_recent_view_bonobo_finalize;
-
- egg_recent_view_bonobo_signals[ACTIVATE] = g_signal_new ("activate",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EggRecentViewBonoboClass, activate),
- NULL, NULL,
- g_cclosure_marshal_VOID__BOXED,
- G_TYPE_NONE, 1,
- EGG_TYPE_RECENT_ITEM);
-
- g_object_class_install_property (object_class,
- PROP_UI_COMPONENT,
- g_param_spec_object ("ui-component",
- "UI Component",
- "BonoboUIComponent for menus.",
- bonobo_ui_component_get_type(),
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class,
- PROP_MENU_PATH,
- g_param_spec_string ("ui-path",
- "Path",
- "The path to put the menu items.",
- "/menus/File/EggRecentDocuments",
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class,
- PROP_SHOW_ICONS,
- g_param_spec_boolean ("show-icons",
- "Show Icons",
- "Whether or not to show icons",
- FALSE,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class,
- PROP_SHOW_NUMBERS,
- g_param_spec_boolean ("show-numbers",
- "Show Numbers",
- "Whether or not to show numbers",
- TRUE,
- G_PARAM_READWRITE));
-
-
-
- klass->activate = NULL;
-}
-
-static void
-egg_recent_view_init (EggRecentViewClass *iface)
-{
- iface->do_get_model = egg_recent_view_bonobo_get_model;
- iface->do_set_model = egg_recent_view_bonobo_set_model;
-}
-
-static void
-show_menus_changed_cb (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- EggRecentViewBonobo *view)
-{
- GConfValue *value;
-
- value = gconf_entry_get_value (entry);
-
- g_return_if_fail (value->type == GCONF_VALUE_BOOL);
-
- egg_recent_view_bonobo_show_icons (view,
- gconf_value_get_bool (value));
-
-}
-
-#ifndef USE_STABLE_LIBGNOMEUI
-static void
-theme_changed_cb (GnomeIconTheme *theme, EggRecentViewBonobo *view)
-{
- if (view->model != NULL)
- egg_recent_model_changed (view->model);
-}
-#endif
-
-static void
-egg_recent_view_bonobo_init (EggRecentViewBonobo *view)
-{
- view->uid = egg_recent_util_get_unique_id ();
-#ifndef USE_STABLE_LIBGNOMEUI
- view->theme = gnome_icon_theme_new ();
- gnome_icon_theme_set_allow_svg (view->theme, TRUE);
- g_signal_connect_object (view->theme, "changed",
- G_CALLBACK (theme_changed_cb), view, 0);
-#endif
-
- view->client = gconf_client_get_default ();
- view->show_icons =
- gconf_client_get_bool (view->client,
- "/desktop/gnome/interface/menus_have_icons",
- NULL);
-
- gconf_client_add_dir (view->client, "/desktop/gnome/interface",
- GCONF_CLIENT_PRELOAD_NONE,
- NULL);
- gconf_client_notify_add (view->client,
- "/desktop/gnome/interface/menus_have_icons",
- (GConfClientNotifyFunc)show_menus_changed_cb,
- view, NULL, NULL);
-
- view->tooltip_func = NULL;
- view->tooltip_func_data = NULL;
-
- view->icon_size = GTK_ICON_SIZE_MENU;
-}
-
-void
-egg_recent_view_bonobo_set_icon_size (EggRecentViewBonobo *view,
- GtkIconSize icon_size)
-{
- if (view->icon_size != icon_size) {
- view->icon_size = icon_size;
- egg_recent_model_changed (view->model);
- } else {
- view->icon_size = icon_size;
- }
-}
-
-GtkIconSize
-egg_recent_view_bonobo_get_icon_size (EggRecentViewBonobo *view)
-{
- return view->icon_size;
-}
-
-void
-egg_recent_view_bonobo_show_icons (EggRecentViewBonobo *view, gboolean show)
-{
- view->show_icons = show;
-
- if (view->model)
- egg_recent_model_changed (view->model);
-}
-
-void
-egg_recent_view_bonobo_show_numbers (EggRecentViewBonobo *view, gboolean show)
-{
- view->show_numbers = show;
-
- if (view->model)
- egg_recent_model_changed (view->model);
-}
-
-void
-egg_recent_view_bonobo_set_ui_component (EggRecentViewBonobo *view, BonoboUIComponent *uic)
-{
- g_return_if_fail (view);
- g_return_if_fail (uic);
-
- view->uic = uic;
-
- g_object_ref (view->uic);
-}
-
-void
-egg_recent_view_bonobo_set_ui_path (EggRecentViewBonobo *view, const gchar *path)
-{
- g_return_if_fail (view);
- g_return_if_fail (path);
-
- view->path = g_strdup (path);
-}
-
-const BonoboUIComponent *
-egg_recent_view_bonobo_get_ui_component (EggRecentViewBonobo *view)
-{
- g_return_val_if_fail (view, NULL);
-
- return view->uic;
-}
-
-gchar *
-egg_recent_view_bonobo_get_ui_path (EggRecentViewBonobo *view)
-{
- g_return_val_if_fail (view, NULL);
-
- return g_strdup (view->path);
-}
-
-void
-egg_recent_view_bonobo_set_tooltip_func (EggRecentViewBonobo *view,
- EggRecentViewBonoboTooltipFunc func,
- gpointer user_data)
-{
- view->tooltip_func = func;
- view->tooltip_func_data = user_data;
-
- if (view->model)
- egg_recent_model_changed (view->model);
-}
-
-/**
- * egg_recent_view_bonobo_new:
- * @appname: The name of your application.
- * @limit: The maximum number of items allowed.
- *
- * This creates a new EggRecentViewBonobo object.
- *
- * Returns: a EggRecentViewBonobo object
- */
-EggRecentViewBonobo *
-egg_recent_view_bonobo_new (BonoboUIComponent *uic, const gchar *path)
-{
- EggRecentViewBonobo *view;
-
- g_return_val_if_fail (uic, NULL);
- g_return_val_if_fail (path, NULL);
-
- view = EGG_RECENT_VIEW_BONOBO (g_object_new (egg_recent_view_bonobo_get_type (),
- "ui-path", path,
- "ui-component", uic,
- "show-icons", FALSE,
- "show-numbers", TRUE, NULL));
-
- g_return_val_if_fail (view, NULL);
-
- return view;
-}
-
-/**
- * egg_recent_view_bonobo_get_type:
- * @:
- *
- * This returns a GType representing a EggRecentViewBonobo object.
- *
- * Returns: a GType
- */
-GType
-egg_recent_view_bonobo_get_type (void)
-{
- static GType egg_recent_view_bonobo_type = 0;
-
- if(!egg_recent_view_bonobo_type) {
- static const GTypeInfo egg_recent_view_bonobo_info = {
- sizeof (EggRecentViewBonoboClass),
- NULL, /* base init */
- NULL, /* base finalize */
- (GClassInitFunc)egg_recent_view_bonobo_class_init, /* class init */
- NULL, /* class finalize */
- NULL, /* class data */
- sizeof (EggRecentViewBonobo),
- 0,
- (GInstanceInitFunc) egg_recent_view_bonobo_init
- };
-
- static const GInterfaceInfo view_info =
- {
- (GInterfaceInitFunc) egg_recent_view_init,
- NULL,
- NULL
- };
-
- egg_recent_view_bonobo_type = g_type_register_static (G_TYPE_OBJECT,
- "EggRecentViewBonobo",
- &egg_recent_view_bonobo_info, 0);
- g_type_add_interface_static (egg_recent_view_bonobo_type,
- EGG_TYPE_RECENT_VIEW,
- &view_info);
- }
-
- return egg_recent_view_bonobo_type;
-}
-
+++ /dev/null
-/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-#ifndef __EGG_RECENT_VIEW_BONOBO_H__
-#define __EGG_RECENT_VIEW_BONOBO_H__
-
-#include <libbonoboui.h>
-
-G_BEGIN_DECLS
-
-#define EGG_RECENT_VIEW_BONOBO(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, egg_recent_view_bonobo_get_type (), EggRecentViewBonobo)
-#define EGG_RECENT_VIEW_BONOBO_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, egg_recent_view_bonobo_get_type (), EggRecentViewBonoboClass)
-#define EGG_IS_RECENT_VIEW_BONOBO(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, egg_recent_view_bonobo_get_type ())
-
-typedef char *(*EggRecentViewBonoboTooltipFunc) (EggRecentItem *item,
- gpointer user_data);
-
-typedef struct _EggRecentViewBonobo EggRecentViewBonobo;
-
-typedef struct _EggRecentViewBonoboClass EggRecentViewBonoboClass;
-
-struct _EggRecentViewBonoboClass {
- GObjectClass parent_class;
-
- void (*activate) (EggRecentViewBonobo *view, EggRecentItem *item);
-};
-
-GType egg_recent_view_bonobo_get_type (void);
-
-EggRecentViewBonobo * egg_recent_view_bonobo_new (BonoboUIComponent *uic,
- const gchar *path);
-
-
-void egg_recent_view_bonobo_set_ui_component (EggRecentViewBonobo *view,
- BonoboUIComponent *uic);
-
-void egg_recent_view_bonobo_set_ui_path (EggRecentViewBonobo *view,
- const gchar *path);
-
-gchar * egg_recent_view_bonobo_get_ui_path (EggRecentViewBonobo *view);
-const BonoboUIComponent *egg_recent_view_bonobo_get_ui_component (EggRecentViewBonobo *view);
-
-void egg_recent_view_bonobo_show_icons (EggRecentViewBonobo *view,
- gboolean show);
-
-void egg_recent_view_bonobo_show_numbers (EggRecentViewBonobo *view,
- gboolean show);
-
-void egg_recent_view_bonobo_set_tooltip_func (EggRecentViewBonobo *view,
- EggRecentViewBonoboTooltipFunc func,
- gpointer user_data);
-
-void egg_recent_view_bonobo_set_icon_size (EggRecentViewBonobo *view,
- GtkIconSize icon_size);
-
-GtkIconSize egg_recent_view_bonobo_get_icon_size (EggRecentViewBonobo *view);
-
-G_END_DECLS
-
-#endif /* __EGG_RECENT_VIEW_BONOBO_H__ */
+++ /dev/null
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/**
- * 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.
- *
- * 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.
- *
- * Authors:
- * James Willcox <jwillcox@cs.indiana.edu>
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <gtk/gtk.h>
-#include <libgnomevfs/gnome-vfs.h>
-#ifndef USE_STABLE_LIBGNOMEUI
-#include <libgnomeui/gnome-icon-theme.h>
-#endif
-#include <gconf/gconf-client.h>
-#include "egg-recent-model.h"
-#include "egg-recent-view.h"
-#include "egg-recent-view-gtk.h"
-#include "egg-recent-util.h"
-#include "egg-recent-item.h"
-
-struct _EggRecentViewGtk {
- GObject parent_instance; /* We emit signals */
-
- GtkWidget *menu;
- GtkWidget *start_menu_item;
-
- gboolean leading_sep;
- gboolean trailing_sep;
-
- gulong changed_cb_id;
-
- gchar *uid;
-
- gboolean show_icons;
- gboolean show_numbers;
-#ifndef USE_STABLE_LIBGNOMEUI
- GnomeIconTheme *theme;
-#endif
-
- GtkTooltips *tooltips;
- EggRecentViewGtkTooltipFunc tooltip_func;
- gpointer tooltip_func_data;
-
- EggRecentModel *model;
- GConfClient *client;
- GtkIconSize icon_size;
-};
-
-
-
-struct _EggRecentViewGtkMenuData {
- EggRecentViewGtk *view;
- EggRecentItem *item;
-};
-
-typedef struct _EggRecentViewGtkMenuData EggRecentViewGtkMenuData;
-
-enum {
- ACTIVATE,
- LAST_SIGNAL
-};
-
-/* GObject properties */
-enum {
- PROP_BOGUS,
- PROP_MENU,
- PROP_START_MENU_ITEM,
- PROP_SHOW_ICONS,
- PROP_SHOW_NUMBERS
-};
-
-static guint view_signals[LAST_SIGNAL] = { 0 };
-
-
-static void
-egg_recent_view_gtk_clear (EggRecentViewGtk *view)
-{
- GList *menu_children;
- GList *p;
- GObject *menu_item;
- gint *menu_data=NULL;
-
- g_return_if_fail (view->menu != NULL);
-
- menu_children = gtk_container_get_children (GTK_CONTAINER (view->menu));
-
- p = menu_children;
- while (p != NULL) {
- menu_item = (GObject *)p->data;
-
- menu_data = (gint *)g_object_get_data (menu_item,
- view->uid);
-
- if (menu_data) {
- gtk_container_remove (GTK_CONTAINER (view->menu),
- GTK_WIDGET (menu_item));
-
- }
-
- p = p->next;
- }
-}
-
-
-static gint
-egg_recent_view_gtk_find_menu_offset (EggRecentViewGtk *view)
-{
- gint i;
- GList *menu_children;
- GList *p;
- GtkWidget *menu_item;
- gint menu_loc=-1;
-
- g_return_val_if_fail (view, 0);
-
- menu_children = GTK_MENU_SHELL (view->menu)->children;
-
- i = 0;
- p = menu_children;
- while (p != NULL) {
- menu_item = (GtkWidget *)p->data;
-
- if (menu_item == view->start_menu_item) {
- menu_loc = i;
- break;
- }
-
- p = p->next;
- i++;
- }
-
- return menu_loc;
-}
-
-static void
-egg_recent_view_gtk_menu_cb (GtkWidget *menu, gpointer data)
-{
- EggRecentViewGtkMenuData *md = (EggRecentViewGtkMenuData *) data;
- EggRecentItem *item;
-
- g_return_if_fail (md);
- g_return_if_fail (md->item);
- g_return_if_fail (md->view);
- g_return_if_fail (EGG_IS_RECENT_VIEW_GTK (md->view));
-
- item = md->item;
-
- egg_recent_item_ref (item);
-
- g_signal_emit (G_OBJECT(md->view), view_signals[ACTIVATE], 0,
- item);
-
- egg_recent_item_unref (item);
-}
-
-static void
-egg_recent_view_gtk_destroy_cb (gpointer data, GClosure *closure)
-{
- EggRecentViewGtkMenuData *md = data;
-
- egg_recent_item_unref (md->item);
- g_free (md);
-}
-
-static GtkWidget *
-egg_recent_view_gtk_new_menu_item (EggRecentViewGtk *view,
- EggRecentItem *item,
- gint index)
-{
- GtkWidget *menu_item;
- EggRecentViewGtkMenuData *md=(EggRecentViewGtkMenuData *)g_malloc (sizeof (EggRecentViewGtkMenuData));
-
- g_return_val_if_fail (view, NULL);
-
- if (item != NULL) {
- gchar *mime_type;
- GtkWidget *image;
- GdkPixbuf *pixbuf;
- gchar *text;
- gchar *short_name;
- gchar *escaped;
-
- short_name = egg_recent_item_get_short_name (item);
- escaped = egg_recent_util_escape_underlines (short_name);
- g_free (short_name);
-
- if (view->show_numbers) {
- /* avoid having conflicting mnemonics */
- if (index >= 10)
- text = g_strdup_printf ("%d. %s", index,
- escaped);
- else
- text = g_strdup_printf ("_%d. %s", index,
- escaped);
- g_free (escaped);
- } else {
- text = escaped;
- }
-
-
- mime_type = egg_recent_item_get_mime_type (item);
-#ifndef USE_STABLE_LIBGNOMEUI
- {
- int width, height;
- gchar *uri;
-
- gtk_icon_size_lookup_for_settings
- (gtk_widget_get_settings (view->menu),
- view->icon_size,
- &width, &height);
-
- uri = egg_recent_item_get_uri (item);
- pixbuf = egg_recent_util_get_icon (view->theme, uri,
- mime_type,
- height);
- g_free (uri);
- }
-#else
- pixbuf = NULL;
-#endif
- image = gtk_image_new_from_pixbuf (pixbuf);
- if (pixbuf)
- g_object_unref (pixbuf);
-
- if (view->show_icons)
- gtk_widget_show (image);
-
- menu_item = gtk_image_menu_item_new_with_mnemonic (text);
- gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_item),
- image);
-
- md->view = view;
- md->item = item;
-
- egg_recent_item_ref (md->item);
-
- g_signal_connect_data (G_OBJECT (menu_item), "activate",
- G_CALLBACK (egg_recent_view_gtk_menu_cb),
- md,
- (GClosureNotify)egg_recent_view_gtk_destroy_cb,
- 0);
-
- g_free (mime_type);
- g_free (text);
- }
- else {
- menu_item = gtk_separator_menu_item_new ();
- }
-
- g_return_val_if_fail (menu_item, NULL);
-
- /**
- * this is a tag so we can distinguish our menu items
- * from others that may be in the menu.
- */
- g_object_set_data (G_OBJECT (menu_item),
- view->uid,
- GINT_TO_POINTER (1));
-
-
- gtk_widget_show (menu_item);
-
- return menu_item;
-}
-
-static void
-egg_recent_view_gtk_add_to_menu (EggRecentViewGtk *view,
- EggRecentItem *item,
- gint display,
- gint index)
-{
- GtkWidget *menu_item;
- gint menu_offset;
-
- g_return_if_fail (view);
- g_return_if_fail (view->menu);
-
- menu_offset = egg_recent_view_gtk_find_menu_offset (view);
-
- menu_item = egg_recent_view_gtk_new_menu_item (view, item, display);
-
- if (view->tooltip_func != NULL && menu_item != NULL) {
- view->tooltip_func (view->tooltips, menu_item,
- item, view->tooltip_func_data);
- }
-
- if (menu_item)
- gtk_menu_shell_insert (GTK_MENU_SHELL (view->menu), menu_item,
- menu_offset+index);
-}
-
-
-
-
-static void
-egg_recent_view_gtk_set_list (EggRecentViewGtk *view, GList *list)
-{
- EggRecentItem *item;
- GList *p;
- gint display=1;
- gint index=1;
-
- g_return_if_fail (view);
-
- egg_recent_view_gtk_clear (view);
-
- if (view->leading_sep) {
- egg_recent_view_gtk_add_to_menu (view, NULL, display, index);
- index++;
- }
-
- p = list;
- while (p != NULL) {
- item = (EggRecentItem *)p->data;
-
- egg_recent_view_gtk_add_to_menu (view, item, display, index);
-
- p = p->next;
- display++;
- index++;
- }
-
- if (view->trailing_sep)
- egg_recent_view_gtk_add_to_menu (view, NULL, display, index);
-}
-
-static void
-model_changed_cb (EggRecentModel *model, GList *list, EggRecentViewGtk *view)
-{
- if (list != NULL)
- egg_recent_view_gtk_set_list (view, list);
- else
- egg_recent_view_gtk_clear (view);
-}
-
-static EggRecentModel *
-egg_recent_view_gtk_get_model (EggRecentView *view_parent)
-{
- EggRecentViewGtk *view;
-
- g_return_val_if_fail (view_parent != NULL, NULL);
- view = EGG_RECENT_VIEW_GTK (view_parent);
- return view->model;
-}
-
-static void
-egg_recent_view_gtk_set_model (EggRecentView *view_parent,
- EggRecentModel *model)
-{
- EggRecentViewGtk *view;
-
- g_return_if_fail (view_parent != NULL);
- view = EGG_RECENT_VIEW_GTK (view_parent);
-
- if (view->model != NULL) {
- g_object_unref (view->model);
- g_signal_handler_disconnect (G_OBJECT (model),
- view->changed_cb_id);
- }
-
- view->model = model;
- g_object_ref (view->model);
-
- view->changed_cb_id = g_signal_connect_object (G_OBJECT (model),
- "changed",
- G_CALLBACK (model_changed_cb),
- view, 0);
-
- egg_recent_model_changed (view->model);
-}
-
-void
-egg_recent_view_gtk_set_leading_sep (EggRecentViewGtk *view, gboolean val)
-{
- view->leading_sep = val;
-
- egg_recent_view_gtk_clear (view);
-
- if (view->model)
- egg_recent_model_changed (view->model);
-}
-
-void
-egg_recent_view_gtk_set_trailing_sep (EggRecentViewGtk *view, gboolean val)
-{
- view->trailing_sep = val;
-
- egg_recent_view_gtk_clear (view);
-
- if (view->model)
- egg_recent_model_changed (view->model);
-}
-
-static void
-egg_recent_view_gtk_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- EggRecentViewGtk *view = EGG_RECENT_VIEW_GTK (object);
-
- switch (prop_id)
- {
- case PROP_MENU:
- egg_recent_view_gtk_set_menu (view,
- GTK_WIDGET (g_value_get_object (value)));
- break;
- case PROP_START_MENU_ITEM:
- egg_recent_view_gtk_set_start_menu_item (view,
- g_value_get_object (value));
- break;
- case PROP_SHOW_ICONS:
- egg_recent_view_gtk_show_icons (view,
- g_value_get_boolean (value));
- break;
- case PROP_SHOW_NUMBERS:
- egg_recent_view_gtk_show_numbers (view,
- g_value_get_boolean (value));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-egg_recent_view_gtk_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- EggRecentViewGtk *view = EGG_RECENT_VIEW_GTK (object);
-
- switch (prop_id)
- {
- case PROP_MENU:
- g_value_set_object (value, view->menu);
- break;
- case PROP_START_MENU_ITEM:
- g_value_set_object (value, view->start_menu_item);
- break;
- case PROP_SHOW_ICONS:
- g_value_set_boolean (value, view->show_icons);
- break;
- case PROP_SHOW_NUMBERS:
- g_value_set_boolean (value, view->show_numbers);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-egg_recent_view_gtk_finalize (GObject *object)
-{
- EggRecentViewGtk *view = EGG_RECENT_VIEW_GTK (object);
-
- g_signal_handler_disconnect (G_OBJECT (view->model),
- view->changed_cb_id);
-
- g_free (view->uid);
-
- g_object_unref (view->menu);
- g_object_unref (view->model);
-#ifndef USE_STABLE_LIBGNOMEUI
- g_object_unref (view->theme);
-#endif
- g_object_unref (view->client);
-
- g_object_unref (view->tooltips);
-}
-
-static void
-egg_recent_view_gtk_class_init (EggRecentViewGtkClass * klass)
-{
- GObjectClass *object_class;
-
- object_class = G_OBJECT_CLASS (klass);
-
- object_class->set_property = egg_recent_view_gtk_set_property;
- object_class->get_property = egg_recent_view_gtk_get_property;
- object_class->finalize = egg_recent_view_gtk_finalize;
-
- view_signals[ACTIVATE] = g_signal_new ("activate",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EggRecentViewGtkClass, activate),
- NULL, NULL,
- g_cclosure_marshal_VOID__BOXED,
- G_TYPE_NONE, 1,
- EGG_TYPE_RECENT_ITEM);
-
- g_object_class_install_property (object_class,
- PROP_MENU,
- g_param_spec_object ("menu",
- "Menu",
- "The GtkMenuShell this object will update.",
- gtk_menu_get_type(),
- G_PARAM_READWRITE));
- g_object_class_install_property (object_class,
- PROP_START_MENU_ITEM,
- g_param_spec_object ("start-menu-item",
- "Start Menu Item",
- "The menu item that precedes where are menu items will go",
- gtk_menu_item_get_type (),
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class,
- PROP_SHOW_ICONS,
- g_param_spec_boolean ("show-icons",
- "Show Icons",
- "Whether or not to show icons",
- FALSE,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class,
- PROP_SHOW_NUMBERS,
- g_param_spec_boolean ("show-numbers",
- "Show Numbers",
- "Whether or not to show numbers",
- TRUE,
- G_PARAM_READWRITE));
-
- klass->activate = NULL;
-}
-
-static void
-egg_recent_view_init (EggRecentViewClass *iface)
-{
- iface->do_get_model = egg_recent_view_gtk_get_model;
- iface->do_set_model = egg_recent_view_gtk_set_model;
-}
-
-static void
-show_menus_changed_cb (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- EggRecentViewGtk *view)
-{
- GConfValue *value;
-
- value = gconf_entry_get_value (entry);
-
- g_return_if_fail (value->type == GCONF_VALUE_BOOL);
-
- egg_recent_view_gtk_show_icons (view,
- gconf_value_get_bool (value));
-
-}
-
-#ifndef USE_STABLE_LIBGNOMEUI
-static void
-theme_changed_cb (GnomeIconTheme *theme, EggRecentViewGtk *view)
-{
- if (view->model != NULL)
- egg_recent_model_changed (view->model);
-}
-#endif
-
-static void
-egg_recent_view_gtk_init (EggRecentViewGtk * view)
-{
- view->client = gconf_client_get_default ();
-
- view->show_icons =
- gconf_client_get_bool (view->client,
- "/desktop/gnome/interface/menus_have_icons",
- NULL);
-
- gconf_client_add_dir (view->client, "/desktop/gnome/interface",
- GCONF_CLIENT_PRELOAD_NONE,
- NULL);
- gconf_client_notify_add (view->client,
- "/desktop/gnome/interface/menus_have_icons",
- (GConfClientNotifyFunc)show_menus_changed_cb,
- view, NULL, NULL);
-
-
- view->leading_sep = FALSE;
- view->trailing_sep = FALSE;
-
- view->uid = egg_recent_util_get_unique_id ();
-#ifndef USE_STABLE_LIBGNOMEUI
- view->theme = gnome_icon_theme_new ();
- gnome_icon_theme_set_allow_svg (view->theme, TRUE);
- g_signal_connect_object (view->theme, "changed",
- G_CALLBACK (theme_changed_cb), view, 0);
-#endif
- view->tooltips = gtk_tooltips_new ();
- g_object_ref (view->tooltips);
- gtk_object_sink (GTK_OBJECT (view->tooltips));
- view->tooltip_func = NULL;
- view->tooltip_func_data = NULL;
-
- view->icon_size = GTK_ICON_SIZE_MENU;
-}
-
-void
-egg_recent_view_gtk_set_icon_size (EggRecentViewGtk *view,
- GtkIconSize icon_size)
-{
- if (view->icon_size != icon_size) {
- view->icon_size = icon_size;
- egg_recent_model_changed (view->model);
- } else {
- view->icon_size = icon_size;
- }
-}
-
-GtkIconSize
-egg_recent_view_gtk_get_icon_size (EggRecentViewGtk *view)
-{
- return view->icon_size;
-}
-
-void
-egg_recent_view_gtk_show_icons (EggRecentViewGtk *view, gboolean show)
-{
- view->show_icons = show;
-
- if (view->model)
- egg_recent_model_changed (view->model);
-}
-
-void
-egg_recent_view_gtk_show_numbers (EggRecentViewGtk *view, gboolean show)
-{
- view->show_numbers = show;
-
- if (view->model)
- egg_recent_model_changed (view->model);
-}
-
-void
-egg_recent_view_gtk_set_tooltip_func (EggRecentViewGtk *view,
- EggRecentViewGtkTooltipFunc func,
- gpointer user_data)
-{
- view->tooltip_func = func;
- view->tooltip_func_data = user_data;
-
- if (view->model)
- egg_recent_model_changed (view->model);
-}
-
-/**
- * egg_recent_view_gtk_set_menu:
- * @view: A EggRecentViewGtk object.
- * @menu: The GtkMenuShell to put the menu items in.
- *
- * Use this function to change the GtkMenuShell that the recent
- * documents appear in.
- *
- */
-void
-egg_recent_view_gtk_set_menu (EggRecentViewGtk *view,
- GtkWidget *menu)
-{
- g_return_if_fail (view);
- g_return_if_fail (EGG_IS_RECENT_VIEW_GTK (view));
- g_return_if_fail (menu);
-
- if (view->menu != NULL)
- g_object_unref (view->menu);
-
- view->menu = menu;
- g_object_ref (view->menu);
-}
-
-/**
- * egg_recent_view_gtk_set_start_menu_item:
- * @view: A EggRecentViewGtk object.
- * @start_menu_item: The menu item that appears just before where our menu
- * items should appear
- *
- */
-void
-egg_recent_view_gtk_set_start_menu_item (EggRecentViewGtk *view,
- GtkWidget *menu_item)
-{
- g_return_if_fail (view);
- g_return_if_fail (EGG_IS_RECENT_VIEW_GTK (view));
-
- view->start_menu_item = menu_item;
-}
-
-/**
- * egg_recent_view_gtk_get_menu:
- * @view: A EggRecentViewGtk object.
- *
- */
-GtkWidget *
-egg_recent_view_gtk_get_menu (EggRecentViewGtk *view)
-{
- return view->menu;
-}
-
-/**
- * egg_recent_view_gtk_get_start_menu_item
- * @view: A EggRecentViewGtk object.
- *
- */
-GtkWidget *
-egg_recent_view_gtk_get_start_menu_item (EggRecentViewGtk *view)
-{
- return view->start_menu_item;
-}
-
-
-/**
- * egg_recent_view_gtk_new:
- * @appname: The name of your application.
- * @limit: The maximum number of items allowed.
- *
- * This creates a new EggRecentViewGtk object.
- *
- * Returns: a EggRecentViewGtk object
- */
-EggRecentViewGtk *
-egg_recent_view_gtk_new (GtkWidget *menu, GtkWidget *start_menu_item)
-{
- EggRecentViewGtk *view;
-
- g_return_val_if_fail (menu, NULL);
-
- view = EGG_RECENT_VIEW_GTK (g_object_new (egg_recent_view_gtk_get_type (),
- "start-menu-item",
- start_menu_item,
- "menu", menu,
- "show-numbers", TRUE, NULL));
-
- g_return_val_if_fail (view, NULL);
-
- return view;
-}
-
-/**
- * egg_recent_view_gtk_get_type:
- * @:
- *
- * This returns a GType representing a EggRecentViewGtk object.
- *
- * Returns: a GType
- */
-GType
-egg_recent_view_gtk_get_type (void)
-{
- static GType egg_recent_view_gtk_type = 0;
-
- if(!egg_recent_view_gtk_type) {
- static const GTypeInfo egg_recent_view_gtk_info = {
- sizeof (EggRecentViewGtkClass),
- NULL, /* base init */
- NULL, /* base finalize */
- (GClassInitFunc)egg_recent_view_gtk_class_init, /* class init */
- NULL, /* class finalize */
- NULL, /* class data */
- sizeof (EggRecentViewGtk),
- 0,
- (GInstanceInitFunc) egg_recent_view_gtk_init
- };
-
- static const GInterfaceInfo view_info =
- {
- (GInterfaceInitFunc) egg_recent_view_init,
- NULL,
- NULL
- };
-
- egg_recent_view_gtk_type = g_type_register_static (G_TYPE_OBJECT,
- "EggRecentViewGtk",
- &egg_recent_view_gtk_info, 0);
- g_type_add_interface_static (egg_recent_view_gtk_type,
- EGG_TYPE_RECENT_VIEW,
- &view_info);
- }
-
- return egg_recent_view_gtk_type;
-}
-
+++ /dev/null
-/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-#ifndef __EGG_RECENT_VIEW_GTK_H__
-#define __EGG_RECENT_VIEW_GTK_H__
-
-G_BEGIN_DECLS
-
-#include <gtk/gtk.h>
-#include "egg-recent-item.h"
-
-#define EGG_RECENT_VIEW_GTK(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, egg_recent_view_gtk_get_type (), EggRecentViewGtk)
-#define EGG_RECENT_VIEW_GTK_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, egg_recent_view_gtk_get_type (), EggRecentViewGtkClass)
-#define EGG_IS_RECENT_VIEW_GTK(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, egg_recent_view_gtk_get_type ())
-
-typedef void (*EggRecentViewGtkTooltipFunc) (GtkTooltips *tooltips,
- GtkWidget *menu,
- EggRecentItem *item,
- gpointer user_data);
-
-typedef struct _EggRecentViewGtk EggRecentViewGtk;
-
-typedef struct _EggRecentViewGtkClass EggRecentViewGtkClass;
-
-struct _EggRecentViewGtkClass {
- GObjectClass parent_class;
-
- void (*activate) (EggRecentViewGtk *view, EggRecentItem *item);
-};
-
-GType egg_recent_view_gtk_get_type (void);
-
-EggRecentViewGtk * egg_recent_view_gtk_new (GtkWidget *menu,
- GtkWidget *start_menu_item);
-
-void egg_recent_view_gtk_set_menu (EggRecentViewGtk *view,
- GtkWidget *menu);
-GtkWidget * egg_recent_view_gtk_get_menu (EggRecentViewGtk *view);
-
-
-void egg_recent_view_gtk_set_start_menu_item (EggRecentViewGtk *view,
- GtkWidget *menu_item);
-GtkWidget *egg_recent_view_gtk_get_start_menu_item (EggRecentViewGtk *view);
-
-void egg_recent_view_gtk_set_leading_sep (EggRecentViewGtk *view,
- gboolean val);
-
-void egg_recent_view_gtk_set_trailing_sep (EggRecentViewGtk *view,
- gboolean val);
-
-void egg_recent_view_gtk_show_icons (EggRecentViewGtk *view,
- gboolean show);
-void egg_recent_view_gtk_show_numbers (EggRecentViewGtk *view,
- gboolean show);
-
-void egg_recent_view_gtk_set_tooltip_func (EggRecentViewGtk *view,
- EggRecentViewGtkTooltipFunc func,
- gpointer user_data);
-
-void egg_recent_view_gtk_set_icon_size (EggRecentViewGtk *view,
- GtkIconSize icon_size);
-GtkIconSize egg_recent_view_gtk_get_icon_size (EggRecentViewGtk *view);
-
-G_END_DECLS
-
-#endif /* __EGG_RECENT_VIEW_GTK_H__ */
--- /dev/null
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/**
+ * 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.
+ *
+ * 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.
+ *
+ * Authors:
+ * James Willcox <jwillcox@cs.indiana.edu>
+ * Paolo Bacchilega <paobac@cvs.gnome.org>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <gtk/gtk.h>
+#include <libgnomevfs/gnome-vfs.h>
+#ifndef USE_STABLE_LIBGNOMEUI
+#include <libgnomeui/gnome-icon-theme.h>
+#endif
+#include <gconf/gconf-client.h>
+#include "egg-recent-model.h"
+#include "egg-recent-view.h"
+#include "egg-recent-view-uimanager.h"
+#include "egg-recent-util.h"
+#include "egg-recent-item.h"
+
+#define EGG_RECENT_NAME_PREFIX "EggRecentAction"
+#define EGG_RECENT_ACTION "EggRecentFile"
+#define EGG_RECENT_SEPARATOR (NULL)
+
+struct _EggRecentViewUIManager {
+ GObject parent_instance;
+
+ GCallback action_callback;
+ gpointer action_user_data;
+
+ gboolean leading_sep;
+ gboolean trailing_sep;
+
+ GtkUIManager *uimanager;
+ GtkActionGroup *action_group;
+ guint merge_id;
+ gulong changed_cb_id;
+
+ gchar *path;
+
+ gboolean show_icons;
+ gboolean show_numbers;
+#ifndef USE_STABLE_LIBGNOMEUI
+ GnomeIconTheme *theme;
+#endif
+
+ EggUIManagerTooltipFunc tooltip_func;
+ gpointer tooltip_func_data;
+
+ EggRecentModel *model;
+ GConfClient *client;
+ GtkIconSize icon_size;
+};
+
+
+struct _EggRecentViewUIManagerMenuData {
+ EggRecentViewUIManager *view;
+ EggRecentItem *item;
+};
+
+typedef struct _EggRecentViewUIManagerMenuData EggRecentViewUIManagerMenuData;
+
+enum {
+ ACTIVATE,
+ LAST_SIGNAL
+};
+
+/* GObject properties */
+enum {
+ PROP_BOGUS,
+ PROP_UIMANAGER,
+ PROP_PATH,
+ PROP_SHOW_ICONS,
+ PROP_SHOW_NUMBERS
+};
+
+static guint view_signals[LAST_SIGNAL] = { 0 };
+
+static void
+egg_recent_view_uimanager_clear (EggRecentViewUIManager *view)
+{
+ if (view->merge_id != 0) {
+ gtk_ui_manager_remove_ui (view->uimanager, view->merge_id);
+ view->merge_id = 0;
+ }
+
+ if (view->action_group != NULL) {
+ gtk_ui_manager_remove_action_group (view->uimanager, view->action_group);
+ g_object_unref (view->action_group);
+ view->action_group = NULL;
+ }
+
+ gtk_ui_manager_ensure_update (view->uimanager);
+}
+
+static void
+egg_recent_view_uimanager_set_list (EggRecentViewUIManager *view, GList *list)
+{
+ GList *scan;
+ guint index = 1;
+
+ g_return_if_fail (view);
+
+ egg_recent_view_uimanager_clear (view);
+
+ if (view->merge_id == 0)
+ view->merge_id = gtk_ui_manager_new_merge_id (view->uimanager);
+
+ if (view->action_group == NULL) {
+ gchar *group = g_strdup_printf ("EggRecentActions%u",
+ view->merge_id);
+ view->action_group = gtk_action_group_new (group);
+ gtk_ui_manager_insert_action_group (view->uimanager, view->action_group, 0);
+ g_free (group);
+ }
+
+ if (view->leading_sep) {
+ gchar *action = g_strdup_printf ("EggRecentLeadingSeparator%u",
+ view->merge_id);
+ gtk_ui_manager_add_ui (view->uimanager,
+ view->merge_id,
+ view->path,
+ action,
+ EGG_RECENT_SEPARATOR,
+ GTK_UI_MANAGER_AUTO,
+ FALSE);
+ g_free (action);
+ }
+
+ for (scan = list; scan; scan = scan->next, index++) {
+ EggRecentItem *item = scan->data;
+ GtkAction *action;
+ gchar *name;
+ gchar *uri;
+ gchar *basename;
+ gchar *escaped;
+ gchar *label;
+ gchar *tooltip = NULL;
+
+ uri = egg_recent_item_get_uri_for_display (item);
+ if (uri == NULL)
+ continue;
+
+ name = g_strdup_printf (EGG_RECENT_NAME_PREFIX"%u-%u",
+ view->merge_id,
+ index);
+
+ if (view->tooltip_func != NULL)
+ tooltip = (*view->tooltip_func) (item, view->tooltip_func_data);
+
+ basename = g_path_get_basename (uri);
+ escaped = egg_recent_util_escape_underlines (basename);
+ g_free (basename);
+ g_free (uri);
+
+ if (view->show_numbers) {
+ if (index >= 10)
+ label = g_strdup_printf ("%d. %s",
+ index,
+ escaped);
+ else
+ label = g_strdup_printf ("_%d. %s",
+ index,
+ escaped);
+ g_free (escaped);
+ } else
+ label = escaped;
+
+ action = g_object_new (GTK_TYPE_ACTION,
+ "name", name,
+ "label", label,
+ (view->show_icons)? "stock_id": NULL,
+ GTK_STOCK_OPEN,
+ NULL);
+ if (tooltip != NULL) {
+ g_object_set (action, "tooltip", tooltip, NULL);
+ g_free (tooltip);
+ }
+ egg_recent_item_ref (item);
+ g_object_set_data_full (G_OBJECT (action),
+ "egg_recent_uri",
+ item,
+ (GFreeFunc) egg_recent_item_unref);
+
+ if (view->action_callback != NULL) {
+ GClosure *closure;
+ closure = g_cclosure_new (view->action_callback, view->action_user_data, NULL);
+ g_signal_connect_closure (action, "activate", closure, FALSE);
+ }
+
+ gtk_action_group_add_action (view->action_group, action);
+ g_object_unref (action);
+
+ gtk_ui_manager_add_ui (view->uimanager,
+ view->merge_id,
+ view->path,
+ name,
+ name,
+ GTK_UI_MANAGER_AUTO,
+ FALSE);
+
+ g_free (name);
+ g_free (label);
+ }
+
+ if (view->trailing_sep) {
+ gchar *action = g_strdup_printf ("EggRecentTrailingSeparator%u",
+ view->merge_id);
+ gtk_ui_manager_add_ui (view->uimanager,
+ view->merge_id,
+ view->path,
+ action,
+ EGG_RECENT_SEPARATOR,
+ GTK_UI_MANAGER_AUTO,
+ FALSE);
+ g_free (action);
+ }
+}
+
+static void
+model_changed_cb (EggRecentModel *model,
+ GList *list,
+ EggRecentViewUIManager *view)
+{
+ if (list != NULL)
+ egg_recent_view_uimanager_set_list (view, list);
+ else
+ egg_recent_view_uimanager_clear (view);
+ gtk_ui_manager_ensure_update (view->uimanager);
+}
+
+static EggRecentModel *
+egg_recent_view_uimanager_get_model (EggRecentView *view_parent)
+{
+ EggRecentViewUIManager *view;
+
+ g_return_val_if_fail (view_parent != NULL, NULL);
+ view = EGG_RECENT_VIEW_UIMANAGER (view_parent);
+ return view->model;
+}
+
+static void
+egg_recent_view_uimanager_set_model (EggRecentView *view_parent,
+ EggRecentModel *model)
+{
+ EggRecentViewUIManager *view;
+
+ g_return_if_fail (view_parent != NULL);
+ view = EGG_RECENT_VIEW_UIMANAGER (view_parent);
+
+ if (view->model != NULL) {
+ if (view->changed_cb_id != 0)
+ g_signal_handler_disconnect (G_OBJECT (view->model),
+ view->changed_cb_id);
+ g_object_unref (view->model);
+ }
+
+ view->model = model;
+ g_object_ref (view->model);
+
+ view->changed_cb_id = g_signal_connect_object (G_OBJECT (model),
+ "changed",
+ G_CALLBACK (model_changed_cb),
+ view, 0);
+
+ egg_recent_model_changed (view->model);
+}
+
+void
+egg_recent_view_uimanager_set_leading_sep (EggRecentViewUIManager *view,
+ gboolean val)
+{
+ view->leading_sep = val;
+ egg_recent_view_uimanager_clear (view);
+ if (view->model)
+ egg_recent_model_changed (view->model);
+}
+
+void
+egg_recent_view_uimanager_set_trailing_sep (EggRecentViewUIManager *view,
+ gboolean val)
+{
+ view->trailing_sep = val;
+ egg_recent_view_uimanager_clear (view);
+ if (view->model)
+ egg_recent_model_changed (view->model);
+}
+
+static void
+egg_recent_view_uimanager_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ EggRecentViewUIManager *view = EGG_RECENT_VIEW_UIMANAGER (object);
+
+ switch (prop_id) {
+ case PROP_UIMANAGER:
+ egg_recent_view_uimanager_set_uimanager (view, (GtkUIManager*)g_value_get_object (value));
+ break;
+ case PROP_PATH:
+ egg_recent_view_uimanager_set_path (view, g_value_get_string (value));
+ break;
+ case PROP_SHOW_ICONS:
+ egg_recent_view_uimanager_show_icons (view, g_value_get_boolean (value));
+ break;
+ case PROP_SHOW_NUMBERS:
+ egg_recent_view_uimanager_show_numbers (view, g_value_get_boolean (value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+egg_recent_view_uimanager_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ EggRecentViewUIManager *view = EGG_RECENT_VIEW_UIMANAGER (object);
+
+ switch (prop_id) {
+ case PROP_UIMANAGER:
+ g_value_set_object (value, view->uimanager);
+ break;
+ case PROP_PATH:
+ g_value_set_string (value, view->path);
+ break;
+ case PROP_SHOW_ICONS:
+ g_value_set_boolean (value, view->show_icons);
+ break;
+ case PROP_SHOW_NUMBERS:
+ g_value_set_boolean (value, view->show_numbers);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+egg_recent_view_uimanager_finalize (GObject *object)
+{
+ EggRecentViewUIManager *view = EGG_RECENT_VIEW_UIMANAGER (object);
+
+ if (view->changed_cb_id != 0) {
+ g_signal_handler_disconnect (G_OBJECT (view->model),
+ view->changed_cb_id);
+ view->changed_cb_id = 0;
+ }
+
+ g_free (view->path);
+
+ egg_recent_view_uimanager_clear (view);
+
+ if (view->action_group != NULL) {
+ g_object_unref (view->action_group);
+ view->action_group = NULL;
+ }
+
+ if (view->uimanager != NULL) {
+ g_object_unref (view->uimanager);
+ view->uimanager = NULL;
+ }
+
+ if (view->model != NULL) {
+ g_object_unref (view->model);
+ view->model = NULL;
+ }
+
+#ifndef USE_STABLE_LIBGNOMEUI
+ if (view->theme != NULL) {
+ g_object_unref (view->theme);
+ view->theme = NULL;
+ }
+#endif
+
+ if (view->client != NULL) {
+ g_object_unref (view->client);
+ view->client = NULL;
+ }
+}
+
+static void
+egg_recent_view_uimanager_class_init (EggRecentViewUIManagerClass * klass)
+{
+ GObjectClass *object_class;
+
+ object_class = G_OBJECT_CLASS (klass);
+
+ object_class->set_property = egg_recent_view_uimanager_set_property;
+ object_class->get_property = egg_recent_view_uimanager_get_property;
+ object_class->finalize = egg_recent_view_uimanager_finalize;
+
+ view_signals[ACTIVATE] = g_signal_new ("activate",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EggRecentViewUIManagerClass, activate),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__BOXED,
+ G_TYPE_NONE, 1,
+ EGG_TYPE_RECENT_ITEM);
+
+ g_object_class_install_property (object_class,
+ PROP_UIMANAGER,
+ g_param_spec_object ("uimanager",
+ "UI Manager",
+ "The UI manager this object will use to update.the UI",
+ GTK_TYPE_UI_MANAGER,
+ G_PARAM_READWRITE));
+ g_object_class_install_property (object_class,
+ PROP_PATH,
+ g_param_spec_string ("path",
+ "Path",
+ "The UI path this object will update.",
+ NULL,
+ G_PARAM_READWRITE));
+ g_object_class_install_property (object_class,
+ PROP_SHOW_ICONS,
+ g_param_spec_boolean ("show-icons",
+ "Show Icons",
+ "Whether or not to show icons",
+ FALSE,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class,
+ PROP_SHOW_NUMBERS,
+ g_param_spec_boolean ("show-numbers",
+ "Show Numbers",
+ "Whether or not to show numbers",
+ TRUE,
+ G_PARAM_READWRITE));
+
+ klass->activate = NULL;
+}
+
+static void
+egg_recent_view_init (EggRecentViewClass *iface)
+{
+ iface->do_get_model = egg_recent_view_uimanager_get_model;
+ iface->do_set_model = egg_recent_view_uimanager_set_model;
+}
+
+static void
+show_menus_changed_cb (GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry,
+ EggRecentViewUIManager *view)
+{
+ GConfValue *value;
+
+ value = gconf_entry_get_value (entry);
+ g_return_if_fail (value->type == GCONF_VALUE_BOOL);
+
+ egg_recent_view_uimanager_show_icons (view, gconf_value_get_bool (value));
+}
+
+#ifndef USE_STABLE_LIBGNOMEUI
+static void
+theme_changed_cb (GnomeIconTheme *theme,
+ EggRecentViewUIManager *view)
+{
+ if (view->model != NULL)
+ egg_recent_model_changed (view->model);
+}
+#endif
+
+static void
+egg_recent_view_uimanager_init (EggRecentViewUIManager * view)
+{
+ view->client = gconf_client_get_default ();
+
+ view->show_icons = gconf_client_get_bool (view->client,
+ "/desktop/gnome/interface/menus_have_icons",
+ NULL);
+
+ gconf_client_add_dir (view->client, "/desktop/gnome/interface",
+ GCONF_CLIENT_PRELOAD_NONE,
+ NULL);
+ gconf_client_notify_add (view->client,
+ "/desktop/gnome/interface/menus_have_icons",
+ (GConfClientNotifyFunc)show_menus_changed_cb,
+ view, NULL, NULL);
+
+
+ view->leading_sep = FALSE;
+ view->trailing_sep = FALSE;
+ view->show_numbers = TRUE;
+
+ view->uimanager = NULL;
+ view->action_group = NULL;
+ view->merge_id = 0;
+ view->changed_cb_id = 0;
+
+ view->path = NULL;
+
+#ifndef USE_STABLE_LIBGNOMEUI
+ view->theme = gnome_icon_theme_new ();
+ gnome_icon_theme_set_allow_svg (view->theme, TRUE);
+ g_signal_connect_object (view->theme, "changed",
+ G_CALLBACK (theme_changed_cb), view, 0);
+#endif
+
+ view->tooltip_func = NULL;
+ view->tooltip_func_data = NULL;
+
+ view->icon_size = GTK_ICON_SIZE_MENU;
+}
+
+void
+egg_recent_view_uimanager_set_icon_size (EggRecentViewUIManager *view,
+ GtkIconSize icon_size)
+{
+ if (view->icon_size != icon_size) {
+ view->icon_size = icon_size;
+ egg_recent_model_changed (view->model);
+ } else {
+ view->icon_size = icon_size;
+ }
+}
+
+GtkIconSize
+egg_recent_view_uimanager_get_icon_size (EggRecentViewUIManager *view)
+{
+ return view->icon_size;
+}
+
+void
+egg_recent_view_uimanager_show_icons (EggRecentViewUIManager *view,
+ gboolean show)
+{
+ view->show_icons = show;
+ if (view->model != NULL)
+ egg_recent_model_changed (view->model);
+}
+
+void
+egg_recent_view_uimanager_show_numbers (EggRecentViewUIManager *view,
+ gboolean show)
+{
+ view->show_numbers = show;
+ if (view->model != NULL)
+ egg_recent_model_changed (view->model);
+}
+
+void
+egg_recent_view_uimanager_set_tooltip_func (EggRecentViewUIManager *view,
+ EggUIManagerTooltipFunc func,
+ gpointer user_data)
+{
+ view->tooltip_func = func;
+ view->tooltip_func_data = user_data;
+ if (view->model)
+ egg_recent_model_changed (view->model);
+}
+
+/**
+ * egg_recent_view_uimanager_set_uimanager:
+ * @view: A EggRecentViewUIManager object.
+ * @uimanager: The ui manager used to put the menu items in.
+ *
+ * Use this function to change the ui manager used to update the menu.
+ *
+ */
+void
+egg_recent_view_uimanager_set_uimanager (EggRecentViewUIManager *view,
+ GtkUIManager *uimanager)
+{
+ g_return_if_fail (EGG_IS_RECENT_VIEW_UIMANAGER (view));
+ g_return_if_fail (uimanager != NULL);
+
+ if (view->uimanager != NULL)
+ g_object_unref (view->uimanager);
+ view->uimanager = uimanager;
+ g_object_ref (view->uimanager);
+}
+
+/**
+ * egg_recent_view_uimanager_get_uimanager:
+ * @view: A EggRecentViewUIManager object.
+ *
+ */
+GtkUIManager*
+egg_recent_view_uimanager_get_uimanager (EggRecentViewUIManager *view)
+{
+ g_return_val_if_fail (EGG_IS_RECENT_VIEW_UIMANAGER (view), NULL);
+ return view->uimanager;
+}
+
+/**
+ * egg_recent_view_uimanager_set_path:
+ * @view: A EggRecentViewUIManager object.
+ * @path: The path to put the menu items in.
+ *
+ * Use this function to change the path where the recent
+ * documents appear in.
+ *
+ */
+void
+egg_recent_view_uimanager_set_path (EggRecentViewUIManager *view,
+ const gchar *path)
+{
+ g_return_if_fail (EGG_IS_RECENT_VIEW_UIMANAGER (view));
+ g_return_if_fail (path);
+
+ g_free (view->path);
+ view->path = g_strdup (path);
+}
+
+/**
+ * egg_recent_view_uimanager_get_path:
+ * @view: A EggRecentViewUIManager object.
+ *
+ */
+G_CONST_RETURN gchar*
+egg_recent_view_uimanager_get_path (EggRecentViewUIManager *view)
+{
+ g_return_val_if_fail (EGG_IS_RECENT_VIEW_UIMANAGER (view), NULL);
+ return view->path;
+}
+
+void
+egg_recent_view_uimanager_set_action_func (EggRecentViewUIManager *view,
+ GCallback callback,
+ gpointer user_data)
+{
+ g_return_if_fail (EGG_IS_RECENT_VIEW_UIMANAGER (view));
+ view->action_callback = callback;
+ view->action_user_data = user_data;
+}
+
+/**
+ * egg_recent_view_uimanager_new:
+ * @appname: The name of your application.
+ * @limit: The maximum number of items allowed.
+ *
+ * This creates a new EggRecentViewUIManager object.
+ *
+ * Returns: a EggRecentViewUIManager object
+ */
+EggRecentViewUIManager *
+egg_recent_view_uimanager_new (GtkUIManager *uimanager,
+ const gchar *path,
+ GCallback callback,
+ gpointer user_data)
+{
+ GObject *view;
+
+ g_return_val_if_fail (uimanager, NULL);
+ g_return_val_if_fail (path, NULL);
+
+ view = g_object_new (egg_recent_view_uimanager_get_type (),
+ "uimanager", uimanager,
+ "path", path,
+ NULL);
+
+ g_return_val_if_fail (view, NULL);
+
+ egg_recent_view_uimanager_set_action_func (EGG_RECENT_VIEW_UIMANAGER (view),
+ callback,
+ user_data);
+
+ return EGG_RECENT_VIEW_UIMANAGER (view);
+}
+
+/**
+ * egg_recent_view_uimanager_get_type:
+ * @:
+ *
+ * This returns a GType representing a EggRecentViewUIManager object.
+ *
+ * Returns: a GType
+ */
+GType
+egg_recent_view_uimanager_get_type (void)
+{
+ static GType egg_recent_view_uimanager_type = 0;
+
+ if(!egg_recent_view_uimanager_type) {
+ static const GTypeInfo egg_recent_view_uimanager_info = {
+ sizeof (EggRecentViewUIManagerClass),
+ NULL, /* base init */
+ NULL, /* base finalize */
+ (GClassInitFunc)egg_recent_view_uimanager_class_init, /* class init */
+ NULL, /* class finalize */
+ NULL, /* class data */
+ sizeof (EggRecentViewUIManager),
+ 0,
+ (GInstanceInitFunc) egg_recent_view_uimanager_init
+ };
+
+ static const GInterfaceInfo view_info =
+ {
+ (GInterfaceInitFunc) egg_recent_view_init,
+ NULL,
+ NULL
+ };
+
+ egg_recent_view_uimanager_type = g_type_register_static (G_TYPE_OBJECT,
+ "EggRecentViewUIManager",
+ &egg_recent_view_uimanager_info, 0);
+ g_type_add_interface_static (egg_recent_view_uimanager_type,
+ EGG_TYPE_RECENT_VIEW,
+ &view_info);
+ }
+
+ return egg_recent_view_uimanager_type;
+}
+
+EggRecentItem*
+egg_recent_view_uimanager_get_item (EggRecentViewUIManager *view,
+ GtkAction *action)
+{
+ return g_object_get_data (G_OBJECT(action), "egg_recent_uri");
+}
--- /dev/null
+/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+#ifndef __EGG_RECENT_VIEW_UIMANAGER_H__
+#define __EGG_RECENT_VIEW_UIMANAGER_H__
+
+
+#include <gtk/gtk.h>
+#include "egg-recent-item.h"
+
+G_BEGIN_DECLS
+
+#define EGG_RECENT_VIEW_UIMANAGER(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, egg_recent_view_uimanager_get_type (), EggRecentViewUIManager)
+#define EGG_RECENT_VIEW_UIMANAGER_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, egg_recent_view_uimanager_get_type (), EggRecentViewUIManagerClass)
+#define EGG_IS_RECENT_VIEW_UIMANAGER(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, egg_recent_view_uimanager_get_type ())
+
+typedef char* (*EggUIManagerTooltipFunc) (EggRecentItem *item,
+ gpointer user_data);
+
+typedef struct _EggRecentViewUIManager EggRecentViewUIManager;
+typedef struct _EggRecentViewUIManagerClass EggRecentViewUIManagerClass;
+
+struct _EggRecentViewUIManagerClass {
+ GObjectClass parent_class;
+ void (*activate) (EggRecentViewUIManager *view, EggRecentItem *item);
+};
+
+GType egg_recent_view_uimanager_get_type (void);
+EggRecentViewUIManager *egg_recent_view_uimanager_new (GtkUIManager *uimanager,
+ const gchar *path,
+ GCallback callback,
+ gpointer user_data);
+void egg_recent_view_uimanager_set_uimanager (EggRecentViewUIManager *view,
+ GtkUIManager *uimanager);
+GtkUIManager* egg_recent_view_uimanager_get_uimanager (EggRecentViewUIManager *view);
+void egg_recent_view_uimanager_set_path (EggRecentViewUIManager *view,
+ const gchar *path);
+G_CONST_RETURN gchar *egg_recent_view_uimanager_get_path (EggRecentViewUIManager *view);
+void egg_recent_view_uimanager_set_action_func (EggRecentViewUIManager *view,
+ GCallback callback,
+ gpointer user_data);
+void egg_recent_view_uimanager_set_leading_sep (EggRecentViewUIManager *view,
+ gboolean val);
+void egg_recent_view_uimanager_set_trailing_sep (EggRecentViewUIManager *view,
+ gboolean val);
+void egg_recent_view_uimanager_show_icons (EggRecentViewUIManager *view,
+ gboolean show);
+void egg_recent_view_uimanager_show_numbers (EggRecentViewUIManager *view,
+ gboolean show);
+void egg_recent_view_uimanager_set_tooltip_func (EggRecentViewUIManager *view,
+ EggUIManagerTooltipFunc func,
+ gpointer user_data);
+void egg_recent_view_uimanager_set_icon_size (EggRecentViewUIManager *view,
+ GtkIconSize icon_size);
+GtkIconSize egg_recent_view_uimanager_get_icon_size (EggRecentViewUIManager *view);
+EggRecentItem *egg_recent_view_uimanager_get_item (EggRecentViewUIManager *view,
+ GtkAction *action);
+
+G_END_DECLS
+
+
+#endif /* __EGG_RECENT_VIEW_UIMANAGER_H__ */
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/**
+/*
* 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
#include "egg-recent-view.h"
#include "egg-recent-view-bonobo.h"
#include "egg-recent-view-gtk.h"
+#include "egg-recent-view-uimanager.h"
+++ /dev/null
-/*
- * (GLABELS) Label and Business Card Creation program for GNOME
- *
- * tools.c: implementation of drawing toolbar verbs
- *
- * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>.
- *
- * 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.
- *
- * 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
- */
-
-#include <config.h>
-
-#include "tools.h"
-
-#include "window.h"
-
-/*===========================================*/
-/* Private types. */
-/*===========================================*/
-
-/*===========================================*/
-/* Private globals. */
-/*===========================================*/
-
-/*===========================================*/
-/* Private function prototypes. */
-/*===========================================*/
-
-
-\f
-/*****************************************************************************/
-/* arrow callback. */
-/*****************************************************************************/
-void
-gl_tools_arrow (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname)
-{
- glWindow *window;
-
- window = GL_WINDOW (user_data);
-
- if (window->view != NULL) {
- gl_view_arrow_mode (GL_VIEW(window->view));
- }
-}
-
-/*****************************************************************************/
-/* text callback. */
-/*****************************************************************************/
-void
-gl_tools_text (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname)
-
-{
- glWindow *window;
-
- window = GL_WINDOW (user_data);
-
- if (window->view != NULL) {
- gl_view_object_create_mode (GL_VIEW(window->view),
- GL_LABEL_OBJECT_TEXT);
- }
-}
-
-/*****************************************************************************/
-/* box callback. */
-/*****************************************************************************/
-void
-gl_tools_box (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname)
-
-{
- glWindow *window;
-
- window = GL_WINDOW (user_data);
-
- if (window->view != NULL) {
- gl_view_object_create_mode (GL_VIEW(window->view),
- GL_LABEL_OBJECT_BOX);
- }
-}
-
-/*****************************************************************************/
-/* line callback. */
-/*****************************************************************************/
-void
-gl_tools_line (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname)
-
-{
- glWindow *window;
-
- window = GL_WINDOW (user_data);
-
- if (window->view != NULL) {
- gl_view_object_create_mode (GL_VIEW(window->view),
- GL_LABEL_OBJECT_LINE);
- }
-}
-
-/*****************************************************************************/
-/* ellipse callback. */
-/*****************************************************************************/
-void
-gl_tools_ellipse (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname)
-
-{
- glWindow *window;
-
- window = GL_WINDOW (user_data);
-
- if (window->view != NULL) {
- gl_view_object_create_mode (GL_VIEW(window->view),
- GL_LABEL_OBJECT_ELLIPSE);
- }
-}
-
-/*****************************************************************************/
-/* image callback. */
-/*****************************************************************************/
-void
-gl_tools_image (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname)
-
-{
- glWindow *window;
-
- window = GL_WINDOW (user_data);
-
- if (window->view != NULL) {
- gl_view_object_create_mode (GL_VIEW(window->view),
- GL_LABEL_OBJECT_IMAGE);
- }
-}
-
-/*****************************************************************************/
-/* barcode callback. */
-/*****************************************************************************/
-void
-gl_tools_barcode (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname)
-
-{
- glWindow *window;
-
- window = GL_WINDOW (user_data);
-
- if (window->view != NULL) {
- gl_view_object_create_mode (GL_VIEW(window->view),
- GL_LABEL_OBJECT_BARCODE);
- }
-}
-
-/*****************************************************************************/
-/* zoom in callback. */
-/*****************************************************************************/
-void
-gl_tools_zoomin (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname)
-
-{
- glWindow *window;
-
- window = GL_WINDOW (user_data);
-
- if (window->view != NULL) {
- gl_view_zoom_in (GL_VIEW(window->view));
- }
-}
-
-/*****************************************************************************/
-/* zoom out callback. */
-/*****************************************************************************/
-void
-gl_tools_zoomout (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname)
-
-{
- glWindow *window;
-
- window = GL_WINDOW (user_data);
-
- if (window->view != NULL) {
- gl_view_zoom_out (GL_VIEW(window->view));
- }
-}
-
-/*****************************************************************************/
-/* zoom 1:1 callback. */
-/*****************************************************************************/
-void
-gl_tools_zoom1to1 (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname)
-
-{
- glWindow *window;
-
- window = GL_WINDOW (user_data);
-
- if (window->view != NULL) {
- gl_view_set_zoom (GL_VIEW(window->view), 1.0);
- }
-}
-
-/*****************************************************************************/
-/* zoom to fit callback. */
-/*****************************************************************************/
-void
-gl_tools_zoom_to_fit (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname)
-
-{
- glWindow *window;
-
- window = GL_WINDOW (user_data);
-
- if (window->view != NULL) {
- gl_view_zoom_to_fit (GL_VIEW(window->view));
- }
-}
-
-/*****************************************************************************/
-/* edit merge properties callback. */
-/*****************************************************************************/
-void
-gl_tools_merge_properties (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname)
-
-{
- glWindow *window;
-
- window = GL_WINDOW (user_data);
-
- if (window->view != NULL) {
- gl_view_edit_merge_props (GL_VIEW(window->view));
- }
-}
-
-/*****************************************************************************/
-/* Raise objects to top callback. */
-/*****************************************************************************/
-void
-gl_tools_raise_objects (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname)
-
-{
- glWindow *window;
-
- window = GL_WINDOW (user_data);
-
- if (window->view != NULL) {
- gl_view_raise_selection (GL_VIEW(window->view));
- }
-}
-
-/*****************************************************************************/
-/* Lower objects to bottom callback. */
-/*****************************************************************************/
-void
-gl_tools_lower_objects (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname)
-
-{
- glWindow *window;
-
- window = GL_WINDOW (user_data);
-
- if (window->view != NULL) {
- gl_view_lower_selection (GL_VIEW(window->view));
- }
-}
-
-/*****************************************************************************/
-/* Rotate objects left 90 degrees. */
-/*****************************************************************************/
-void
-gl_tools_rotate_objects_left (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname)
-
-{
- glWindow *window;
-
- window = GL_WINDOW (user_data);
-
- if (window->view != NULL) {
- gl_view_rotate_selection_left (GL_VIEW(window->view));
- }
-}
-
-/*****************************************************************************/
-/* Rotate objects right 90 degrees. */
-/*****************************************************************************/
-void
-gl_tools_rotate_objects_right (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname)
-
-{
- glWindow *window;
-
- window = GL_WINDOW (user_data);
-
- if (window->view != NULL) {
- gl_view_rotate_selection_right (GL_VIEW(window->view));
- }
-}
-
-/*****************************************************************************/
-/* Flip objects horizontally callback. */
-/*****************************************************************************/
-void
-gl_tools_flip_objects_horiz (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname)
-
-{
- glWindow *window;
-
- window = GL_WINDOW (user_data);
-
- if (window->view != NULL) {
- gl_view_flip_selection_horiz (GL_VIEW(window->view));
- }
-}
-
-/*****************************************************************************/
-/* Flip objects vertically callback. */
-/*****************************************************************************/
-void
-gl_tools_flip_objects_vert (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname)
-
-{
- glWindow *window;
-
- window = GL_WINDOW (user_data);
-
- if (window->view != NULL) {
- gl_view_flip_selection_vert (GL_VIEW(window->view));
- }
-}
-
-/*****************************************************************************/
-/* Align objects left callback. */
-/*****************************************************************************/
-void
-gl_tools_align_objects_left (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname)
-
-{
- glWindow *window;
-
- window = GL_WINDOW (user_data);
-
- if (window->view != NULL) {
- gl_view_align_selection_left (GL_VIEW(window->view));
- }
-}
-
-/*****************************************************************************/
-/* Align objects right callback. */
-/*****************************************************************************/
-void
-gl_tools_align_objects_right (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname)
-
-{
- glWindow *window;
-
- window = GL_WINDOW (user_data);
-
- if (window->view != NULL) {
- gl_view_align_selection_right (GL_VIEW(window->view));
- }
-}
-
-/*****************************************************************************/
-/* Align objects horizontal center callback. */
-/*****************************************************************************/
-void
-gl_tools_align_objects_hcenter (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname)
-
-{
- glWindow *window;
-
- window = GL_WINDOW (user_data);
-
- if (window->view != NULL) {
- gl_view_align_selection_hcenter (GL_VIEW(window->view));
- }
-}
-
-/*****************************************************************************/
-/* Align objects top callback. */
-/*****************************************************************************/
-void
-gl_tools_align_objects_top (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname)
-
-{
- glWindow *window;
-
- window = GL_WINDOW (user_data);
-
- if (window->view != NULL) {
- gl_view_align_selection_top (GL_VIEW(window->view));
- }
-}
-
-/*****************************************************************************/
-/* Align objects bottom callback. */
-/*****************************************************************************/
-void
-gl_tools_align_objects_bottom (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname)
-
-{
- glWindow *window;
-
- window = GL_WINDOW (user_data);
-
- if (window->view != NULL) {
- gl_view_align_selection_bottom (GL_VIEW(window->view));
- }
-}
-
-/*****************************************************************************/
-/* Align objects vertical center callback. */
-/*****************************************************************************/
-void
-gl_tools_align_objects_vcenter (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname)
-
-{
- glWindow *window;
-
- window = GL_WINDOW (user_data);
-
- if (window->view != NULL) {
- gl_view_align_selection_vcenter (GL_VIEW(window->view));
- }
-}
-
-/*****************************************************************************/
-/* Center objects horizontally callback. */
-/*****************************************************************************/
-void
-gl_tools_center_objects_horiz (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname)
-
-{
- glWindow *window;
-
- window = GL_WINDOW (user_data);
-
- if (window->view != NULL) {
- gl_view_center_selection_horiz (GL_VIEW(window->view));
- }
-}
-
-/*****************************************************************************/
-/* Center objects vertically callback. */
-/*****************************************************************************/
-void
-gl_tools_center_objects_vert (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname)
-
-{
- glWindow *window;
-
- window = GL_WINDOW (user_data);
-
- if (window->view != NULL) {
- gl_view_center_selection_vert (GL_VIEW(window->view));
- }
-}
-
+++ /dev/null
-/*
- * (GLABELS) Label and Business Card Creation program for GNOME
- *
- * tools.h: toolbar module header file
- *
- * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>.
- *
- * 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.
- *
- * 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
- */
-#ifndef __TOOLS_H__
-#define __TOOLS_H__
-
-#include <bonobo/bonobo-ui-component.h>
-
-G_BEGIN_DECLS
-
-void gl_tools_arrow (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname);
-
-void gl_tools_text (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname);
-
-void gl_tools_box (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname);
-
-void gl_tools_line (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname);
-
-void gl_tools_ellipse (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname);
-
-void gl_tools_image (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname);
-
-void gl_tools_barcode (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname);
-
-void gl_tools_zoomin (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname);
-
-void gl_tools_zoomout (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname);
-
-void gl_tools_zoom1to1 (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname);
-
-void gl_tools_zoom_to_fit (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname);
-
-void gl_tools_merge_properties (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname);
-
-void gl_tools_raise_objects (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname);
-
-void gl_tools_lower_objects (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname);
-
-void gl_tools_rotate_objects_left (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname);
-
-void gl_tools_rotate_objects_right (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname);
-
-void gl_tools_flip_objects_horiz (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname);
-
-void gl_tools_flip_objects_vert (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname);
-
-void gl_tools_align_objects_left (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname);
-
-void gl_tools_align_objects_right (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname);
-
-void gl_tools_align_objects_hcenter (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname);
-
-void gl_tools_align_objects_top (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname);
-
-void gl_tools_align_objects_bottom (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname);
-
-void gl_tools_align_objects_vcenter (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname);
-
-void gl_tools_center_objects_horiz (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname);
-
-void gl_tools_center_objects_vert (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname);
-
-G_END_DECLS
-
-#endif
--- /dev/null
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/**
+ * (GLABELS) Label and Business Card Creation program for GNOME
+ *
+ * ui-commands.c: GLabels UI commands module
+ *
+ * Copyright (C) 2001-2003 Jim Evins <evins@snaught.com>.
+ *
+ * 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.
+ *
+ * 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
+ */
+
+#include <config.h>
+
+#include "ui-commands.h"
+
+#include <glib/gi18n.h>
+#include <gtk/gtkwindow.h>
+#include <gtk/gtkaboutdialog.h>
+#include <libgnome/gnome-help.h>
+#include <libgnome/gnome-url.h>
+#include "recent-files/egg-recent-view.h"
+#include "recent-files/egg-recent-view-uimanager.h"
+
+#include "view.h"
+#include "file.h"
+#include "template-designer.h"
+#include "print-dialog.h"
+#include "prefs.h"
+#include "prefs-dialog.h"
+#include "recent.h"
+#include "debug.h"
+
+#define LOGO_PIXMAP gnome_program_locate_file (NULL,\
+ GNOME_FILE_DOMAIN_APP_PIXMAP,\
+ "glabels/glabels-about-logo.png",\
+ FALSE, NULL)
+
+\f
+/****************************************************************************/
+/** File/New command. */
+/****************************************************************************/
+void
+gl_ui_cmd_file_new (GtkAction *action,
+ glWindow *window)
+{
+ gl_debug (DEBUG_COMMANDS, "START");
+
+ g_return_if_fail (action && GTK_IS_ACTION(action));
+ g_return_if_fail (window && GL_IS_WINDOW(window));
+
+ gl_file_new (window);
+
+ gl_debug (DEBUG_COMMANDS, "END");
+}
+
+/****************************************************************************/
+/** File/Properties command. */
+/****************************************************************************/
+void
+gl_ui_cmd_file_properties (GtkAction *action,
+ glWindow *window)
+{
+ gl_debug (DEBUG_COMMANDS, "START");
+
+ g_return_if_fail (action && GTK_IS_ACTION(action));
+ g_return_if_fail (window && GL_IS_WINDOW(window));
+
+ gl_file_properties (GL_VIEW(window->view)->label, window);
+
+ gl_debug (DEBUG_COMMANDS, "END");
+}
+
+/****************************************************************************/
+/** File/Template-Designer command. */
+/****************************************************************************/
+void
+gl_ui_cmd_file_template_designer (GtkAction *action,
+ glWindow *window)
+{
+ GtkWidget *dialog;
+
+ gl_debug (DEBUG_COMMANDS, "START");
+
+ g_return_if_fail (action && GTK_IS_ACTION(action));
+ g_return_if_fail (window && GL_IS_WINDOW(window));
+
+ dialog = gl_template_designer_new (GTK_WINDOW(window));
+
+ gtk_widget_show (dialog);
+
+ gl_debug (DEBUG_COMMANDS, "END");
+}
+
+/****************************************************************************/
+/** File/Open command. */
+/****************************************************************************/
+void
+gl_ui_cmd_file_open (GtkAction *action,
+ glWindow *window)
+{
+ gl_debug (DEBUG_COMMANDS, "START");
+
+ g_return_if_fail (action && GTK_IS_ACTION(action));
+ g_return_if_fail (window && GL_IS_WINDOW(window));
+
+ gl_file_open (window);
+
+ gl_debug (DEBUG_COMMANDS, "END");
+}
+
+/****************************************************************************/
+/** File/Open-Recent command. */
+/****************************************************************************/
+void
+gl_ui_cmd_file_open_recent (GtkAction *action,
+ glWindow *window)
+{
+ EggRecentItem *item;
+ gchar *utf8_filename;
+
+ gl_debug (DEBUG_COMMANDS, "START");
+
+ g_return_if_fail (action && GTK_IS_ACTION(action));
+ g_return_if_fail (window && GL_IS_WINDOW(window));
+
+ item = egg_recent_view_uimanager_get_item (window->recent_view, action);
+ utf8_filename = gl_recent_get_filename (item);
+
+ gl_file_open_recent (utf8_filename, window);
+
+ gl_debug (DEBUG_COMMANDS, "END");
+}
+
+/****************************************************************************/
+/** File/Save command. */
+/****************************************************************************/
+void
+gl_ui_cmd_file_save (GtkAction *action,
+ glWindow *window)
+{
+ gl_debug (DEBUG_COMMANDS, "START");
+
+ g_return_if_fail (action && GTK_IS_ACTION(action));
+ g_return_if_fail (window && GL_IS_WINDOW(window));
+
+ gl_file_save (GL_VIEW(window->view)->label, window);
+
+ gl_debug (DEBUG_COMMANDS, "END");
+}
+
+/****************************************************************************/
+/** File/Save-as command. */
+/****************************************************************************/
+void
+gl_ui_cmd_file_save_as (GtkAction *action,
+ glWindow *window)
+{
+ gl_debug (DEBUG_COMMANDS, "START");
+
+ g_return_if_fail (action && GTK_IS_ACTION(action));
+ g_return_if_fail (window && GL_IS_WINDOW(window));
+
+ gl_file_save_as (GL_VIEW(window->view)->label, window);
+
+ gl_debug (DEBUG_COMMANDS, "END");
+}
+
+/****************************************************************************/
+/** File/Print command. */
+/****************************************************************************/
+void
+gl_ui_cmd_file_print (GtkAction *action,
+ glWindow *window)
+{
+ gl_debug (DEBUG_COMMANDS, "START");
+
+ g_return_if_fail (action && GTK_IS_ACTION(action));
+ g_return_if_fail (window && GL_IS_WINDOW(window));
+
+ if (GL_VIEW(window->view)->print_dialog) {
+
+ gtk_window_present (GTK_WINDOW(GL_VIEW(window->view)->print_dialog));
+
+ } else {
+
+ GL_VIEW(window->view)->print_dialog =
+ g_object_ref (
+ gl_print_dialog_new (GL_VIEW(window->view)->label,
+ BONOBO_WINDOW(window)) );
+
+ gtk_widget_show (GL_VIEW(window->view)->print_dialog);
+ }
+
+ gl_debug (DEBUG_COMMANDS, "END");
+}
+
+/****************************************************************************/
+/** File/Close command. */
+/****************************************************************************/
+void
+gl_ui_cmd_file_close (GtkAction *action,
+ glWindow *window)
+{
+ gl_debug (DEBUG_COMMANDS, "START");
+
+ g_return_if_fail (action && GTK_IS_ACTION(action));
+ g_return_if_fail (window && GL_IS_WINDOW(window));
+
+ gl_file_close (window);
+
+ gl_debug (DEBUG_COMMANDS, "END");
+}
+
+/****************************************************************************/
+/** File/Quit command. */
+/****************************************************************************/
+void
+gl_ui_cmd_file_quit (GtkAction *action,
+ glWindow *window)
+{
+ gl_debug (DEBUG_COMMANDS, "START");
+
+ g_return_if_fail (action && GTK_IS_ACTION(action));
+ g_return_if_fail (window && GL_IS_WINDOW(window));
+
+ gl_file_exit ();
+
+ gl_debug (DEBUG_COMMANDS, "END");
+}
+
+
+/****************************************************************************/
+/** Edit/Cut command. */
+/****************************************************************************/
+void
+gl_ui_cmd_edit_cut (GtkAction *action,
+ glWindow *window)
+{
+ gl_debug (DEBUG_COMMANDS, "START");
+
+ g_return_if_fail (action && GTK_IS_ACTION(action));
+ g_return_if_fail (window && GL_IS_WINDOW(window));
+
+ gl_view_cut (GL_VIEW(window->view));
+
+ gl_debug (DEBUG_COMMANDS, "END");
+}
+
+/****************************************************************************/
+/** Edit/Copy command. */
+/****************************************************************************/
+void
+gl_ui_cmd_edit_copy (GtkAction *action,
+ glWindow *window)
+{
+ gl_debug (DEBUG_COMMANDS, "START");
+
+ g_return_if_fail (action && GTK_IS_ACTION(action));
+ g_return_if_fail (window && GL_IS_WINDOW(window));
+
+ gl_view_copy (GL_VIEW(window->view));
+
+ gl_debug (DEBUG_COMMANDS, "END");
+}
+
+/****************************************************************************/
+/** Edit/Paste command. */
+/****************************************************************************/
+void
+gl_ui_cmd_edit_paste (GtkAction *action,
+ glWindow *window)
+{
+ gl_debug (DEBUG_COMMANDS, "START");
+
+ g_return_if_fail (action && GTK_IS_ACTION(action));
+ g_return_if_fail (window && GL_IS_WINDOW(window));
+
+ gl_view_paste (GL_VIEW(window->view));
+
+ gl_debug (DEBUG_COMMANDS, "END");
+}
+
+
+/****************************************************************************/
+/** Edit/Delete command. */
+/****************************************************************************/
+void
+gl_ui_cmd_edit_delete (GtkAction *action,
+ glWindow *window)
+{
+ gl_debug (DEBUG_COMMANDS, "START");
+
+ g_return_if_fail (action && GTK_IS_ACTION(action));
+ g_return_if_fail (window && GL_IS_WINDOW(window));
+
+ gl_view_delete_selection (GL_VIEW(window->view));
+
+ gl_debug (DEBUG_COMMANDS, "END");
+}
+
+
+/****************************************************************************/
+/** Edit/Select-all command. */
+/****************************************************************************/
+void
+gl_ui_cmd_edit_select_all (GtkAction *action,
+ glWindow *window)
+{
+ gl_debug (DEBUG_COMMANDS, "START");
+
+ g_return_if_fail (action && GTK_IS_ACTION(action));
+ g_return_if_fail (window && GL_IS_WINDOW(window));
+
+ gl_view_select_all (GL_VIEW(window->view));
+
+ gl_debug (DEBUG_COMMANDS, "END");
+}
+
+/****************************************************************************/
+/** Edit/Unselect-all command. */
+/****************************************************************************/
+void
+gl_ui_cmd_edit_unselect_all (GtkAction *action,
+ glWindow *window)
+{
+ gl_debug (DEBUG_COMMANDS, "START");
+
+ g_return_if_fail (action && GTK_IS_ACTION(action));
+ g_return_if_fail (window && GL_IS_WINDOW(window));
+
+ gl_view_unselect_all (GL_VIEW(window->view));
+
+ gl_debug (DEBUG_COMMANDS, "END");
+}
+
+/****************************************************************************/
+/** Edit/Preferences command. */
+/****************************************************************************/
+void
+gl_ui_cmd_edit_preferences (GtkAction *action,
+ glWindow *window)
+{
+ static GtkWidget *dlg = NULL;
+
+ gl_debug (DEBUG_COMMANDS, "START");
+
+ g_return_if_fail (action && GTK_IS_ACTION(action));
+ g_return_if_fail (window && GL_IS_WINDOW(window));
+
+ if (dlg != NULL)
+ {
+ gtk_window_present (GTK_WINDOW (dlg));
+ gtk_window_set_transient_for (GTK_WINDOW (dlg),
+ GTK_WINDOW(window));
+
+ } else {
+
+ dlg = gl_prefs_dialog_new (GTK_WINDOW(window));
+
+ g_signal_connect (G_OBJECT (dlg), "destroy",
+ G_CALLBACK (gtk_widget_destroyed), &dlg);
+
+ gtk_widget_show (dlg);
+
+ }
+
+ gl_debug (DEBUG_COMMANDS, "END");
+}
+
+/*****************************************************************************/
+/** View/Property-bar-toggle command. */
+/*****************************************************************************/
+void
+gl_ui_cmd_view_property_bar_toggle (GtkToggleAction *action,
+ glWindow *window)
+{
+ gboolean state;
+
+ gl_debug (DEBUG_COMMANDS, "START");
+
+ g_return_if_fail (action && GTK_IS_TOGGLE_ACTION(action));
+ g_return_if_fail (window && GL_IS_WINDOW(window));
+
+ state = gtk_toggle_action_get_active (action);
+
+ gl_prefs->property_toolbar_visible = state;
+ if (state) {
+ gtk_widget_show (GTK_WIDGET (window->property_bar));
+ } else {
+ gtk_widget_hide (GTK_WIDGET (window->property_bar));
+ }
+ gl_prefs_model_save_settings (gl_prefs);
+
+ gl_debug (DEBUG_COMMANDS, "END");
+}
+
+/*****************************************************************************/
+/** View/Property-bar-tooltips-toggle command. */
+/*****************************************************************************/
+void
+gl_ui_cmd_view_property_bar_tips_toggle (GtkToggleAction *action,
+ glWindow *window)
+{
+ gboolean state;
+
+ gl_debug (DEBUG_COMMANDS, "START");
+
+ g_return_if_fail (action && GTK_IS_TOGGLE_ACTION(action));
+ g_return_if_fail (window && GL_IS_WINDOW(window));
+
+ state = gtk_toggle_action_get_active (action);
+
+ gl_prefs->property_toolbar_view_tooltips = state;
+ gl_ui_property_bar_set_tooltips (window->property_bar, state);
+ gl_prefs_model_save_settings (gl_prefs);
+
+ gl_debug (DEBUG_COMMANDS, "END");
+}
+
+/*****************************************************************************/
+/** View/Grid-toggle command. */
+/*****************************************************************************/
+void
+gl_ui_cmd_view_grid_toggle (GtkToggleAction *action,
+ glWindow *window)
+{
+ gboolean state;
+
+ gl_debug (DEBUG_COMMANDS, "START");
+
+ g_return_if_fail (action && GTK_IS_TOGGLE_ACTION(action));
+ g_return_if_fail (window && GL_IS_WINDOW(window));
+
+ state = gtk_toggle_action_get_active (action);
+
+ gl_prefs->grid_visible = state;
+ if (state) {
+ gl_view_show_grid (GL_VIEW(window->view));
+ } else {
+ gl_view_hide_grid (GL_VIEW(window->view));
+ }
+ gl_prefs_model_save_settings (gl_prefs);
+
+ gl_debug (DEBUG_COMMANDS, "END");
+}
+
+/*****************************************************************************/
+/** View/Markup-toggle command. */
+/*****************************************************************************/
+void
+gl_ui_cmd_view_markup_toggle (GtkToggleAction *action,
+ glWindow *window)
+{
+ gboolean state;
+
+ gl_debug (DEBUG_COMMANDS, "START");
+
+ g_return_if_fail (action && GTK_IS_TOGGLE_ACTION(action));
+ g_return_if_fail (window && GL_IS_WINDOW(window));
+
+ state = gtk_toggle_action_get_active (action);
+
+ gl_prefs->markup_visible = state;
+ if (state) {
+ gl_view_show_markup (GL_VIEW(window->view));
+ } else {
+ gl_view_hide_markup (GL_VIEW(window->view));
+ }
+ gl_prefs_model_save_settings (gl_prefs);
+
+ gl_debug (DEBUG_COMMANDS, "END");
+}
+
+/*****************************************************************************/
+/** View/Zoom-in command. */
+/*****************************************************************************/
+void
+gl_ui_cmd_view_zoomin (GtkAction *action,
+ glWindow *window)
+
+{
+ gl_debug (DEBUG_COMMANDS, "START");
+
+ g_return_if_fail (action && GTK_IS_ACTION(action));
+ g_return_if_fail (window && GL_IS_WINDOW(window));
+
+ if (window->view != NULL) {
+ gl_view_zoom_in (GL_VIEW(window->view));
+ }
+
+ gl_debug (DEBUG_COMMANDS, "END");
+}
+
+/*****************************************************************************/
+/** View/Zoom-out command. */
+/*****************************************************************************/
+void
+gl_ui_cmd_view_zoomout (GtkAction *action,
+ glWindow *window)
+
+{
+ gl_debug (DEBUG_COMMANDS, "START");
+
+ g_return_if_fail (action && GTK_IS_ACTION(action));
+ g_return_if_fail (window && GL_IS_WINDOW(window));
+
+ if (window->view != NULL) {
+ gl_view_zoom_out (GL_VIEW(window->view));
+ }
+
+ gl_debug (DEBUG_COMMANDS, "END");
+}
+
+/*****************************************************************************/
+/** View/Zoom-1:1 command. */
+/*****************************************************************************/
+void
+gl_ui_cmd_view_zoom1to1 (GtkAction *action,
+ glWindow *window)
+
+{
+ gl_debug (DEBUG_COMMANDS, "START");
+
+ g_return_if_fail (action && GTK_IS_ACTION(action));
+ g_return_if_fail (window && GL_IS_WINDOW(window));
+
+ if (window->view != NULL) {
+ gl_view_set_zoom (GL_VIEW(window->view), 1.0);
+ }
+
+ gl_debug (DEBUG_COMMANDS, "END");
+}
+
+/*****************************************************************************/
+/** View/Zoom-to-fit command. */
+/*****************************************************************************/
+void
+gl_ui_cmd_view_zoom_to_fit (GtkAction *action,
+ glWindow *window)
+
+{
+ gl_debug (DEBUG_COMMANDS, "START");
+
+ g_return_if_fail (action && GTK_IS_ACTION(action));
+ g_return_if_fail (window && GL_IS_WINDOW(window));
+
+ if (window->view != NULL) {
+ gl_view_zoom_to_fit (GL_VIEW(window->view));
+ }
+
+ gl_debug (DEBUG_COMMANDS, "END");
+}
+
+/*****************************************************************************/
+/** Objects/Arrow-mode command. */
+/*****************************************************************************/
+void
+gl_ui_cmd_objects_arrow_mode (GtkAction *action,
+ glWindow *window)
+{
+ gl_debug (DEBUG_COMMANDS, "START");
+
+ g_return_if_fail (action && GTK_IS_ACTION(action));
+ g_return_if_fail (window && GL_IS_WINDOW(window));
+
+ if (window->view != NULL) {
+ gl_view_arrow_mode (GL_VIEW(window->view));
+ }
+
+ gl_debug (DEBUG_COMMANDS, "END");
+}
+
+/*****************************************************************************/
+/** Objects/Create-text object command. */
+/*****************************************************************************/
+void
+gl_ui_cmd_objects_create_text (GtkAction *action,
+ glWindow *window)
+
+{
+ gl_debug (DEBUG_COMMANDS, "START");
+
+ g_return_if_fail (action && GTK_IS_ACTION(action));
+ g_return_if_fail (window && GL_IS_WINDOW(window));
+
+ if (window->view != NULL) {
+ gl_view_object_create_mode (GL_VIEW(window->view),
+ GL_LABEL_OBJECT_TEXT);
+ }
+
+ gl_debug (DEBUG_COMMANDS, "END");
+}
+
+/*****************************************************************************/
+/** Objects/Create-box object command. */
+/*****************************************************************************/
+void
+gl_ui_cmd_objects_create_box (GtkAction *action,
+ glWindow *window)
+
+{
+ gl_debug (DEBUG_COMMANDS, "START");
+
+ g_return_if_fail (action && GTK_IS_ACTION(action));
+ g_return_if_fail (window && GL_IS_WINDOW(window));
+
+ if (window->view != NULL) {
+ gl_view_object_create_mode (GL_VIEW(window->view),
+ GL_LABEL_OBJECT_BOX);
+ }
+
+ gl_debug (DEBUG_COMMANDS, "END");
+}
+
+/*****************************************************************************/
+/** Objects/Create-line object command. */
+/*****************************************************************************/
+void
+gl_ui_cmd_objects_create_line (GtkAction *action,
+ glWindow *window)
+
+{
+ gl_debug (DEBUG_COMMANDS, "START");
+
+ g_return_if_fail (action && GTK_IS_ACTION(action));
+ g_return_if_fail (window && GL_IS_WINDOW(window));
+
+ if (window->view != NULL) {
+ gl_view_object_create_mode (GL_VIEW(window->view),
+ GL_LABEL_OBJECT_LINE);
+ }
+
+ gl_debug (DEBUG_COMMANDS, "END");
+}
+
+/*****************************************************************************/
+/** Objects/Create-ellipse object command. */
+/*****************************************************************************/
+void
+gl_ui_cmd_objects_create_ellipse (GtkAction *action,
+ glWindow *window)
+
+{
+ gl_debug (DEBUG_COMMANDS, "START");
+
+ g_return_if_fail (action && GTK_IS_ACTION(action));
+ g_return_if_fail (window && GL_IS_WINDOW(window));
+
+ if (window->view != NULL) {
+ gl_view_object_create_mode (GL_VIEW(window->view),
+ GL_LABEL_OBJECT_ELLIPSE);
+ }
+
+ gl_debug (DEBUG_COMMANDS, "END");
+}
+
+/*****************************************************************************/
+/** Objects/Create-image object command. */
+/*****************************************************************************/
+void
+gl_ui_cmd_objects_create_image (GtkAction *action,
+ glWindow *window)
+
+{
+ gl_debug (DEBUG_COMMANDS, "START");
+
+ g_return_if_fail (action && GTK_IS_ACTION(action));
+ g_return_if_fail (window && GL_IS_WINDOW(window));
+
+ if (window->view != NULL) {
+ gl_view_object_create_mode (GL_VIEW(window->view),
+ GL_LABEL_OBJECT_IMAGE);
+ }
+
+ gl_debug (DEBUG_COMMANDS, "END");
+}
+
+/*****************************************************************************/
+/** Objects/Create-barcode object command. */
+/*****************************************************************************/
+void
+gl_ui_cmd_objects_create_barcode (GtkAction *action,
+ glWindow *window)
+
+{
+ gl_debug (DEBUG_COMMANDS, "START");
+
+ g_return_if_fail (action && GTK_IS_ACTION(action));
+ g_return_if_fail (window && GL_IS_WINDOW(window));
+
+ if (window->view != NULL) {
+ gl_view_object_create_mode (GL_VIEW(window->view),
+ GL_LABEL_OBJECT_BARCODE);
+ }
+
+ gl_debug (DEBUG_COMMANDS, "END");
+}
+
+/*****************************************************************************/
+/** Objects/Raise command. */
+/*****************************************************************************/
+void
+gl_ui_cmd_objects_raise (GtkAction *action,
+ glWindow *window)
+
+{
+ gl_debug (DEBUG_COMMANDS, "START");
+
+ g_return_if_fail (action && GTK_IS_ACTION(action));
+ g_return_if_fail (window && GL_IS_WINDOW(window));
+
+ if (window->view != NULL) {
+ gl_view_raise_selection (GL_VIEW(window->view));
+ }
+
+ gl_debug (DEBUG_COMMANDS, "END");
+}
+
+/*****************************************************************************/
+/** Objects/Lower command. */
+/*****************************************************************************/
+void
+gl_ui_cmd_objects_lower (GtkAction *action,
+ glWindow *window)
+
+{
+ gl_debug (DEBUG_COMMANDS, "START");
+
+ g_return_if_fail (action && GTK_IS_ACTION(action));
+ g_return_if_fail (window && GL_IS_WINDOW(window));
+
+ if (window->view != NULL) {
+ gl_view_lower_selection (GL_VIEW(window->view));
+ }
+
+ gl_debug (DEBUG_COMMANDS, "END");
+}
+
+/*****************************************************************************/
+/** Objects/Rotate-left-90-degrees command. */
+/*****************************************************************************/
+void
+gl_ui_cmd_objects_rotate_left (GtkAction *action,
+ glWindow *window)
+
+{
+ gl_debug (DEBUG_COMMANDS, "START");
+
+ g_return_if_fail (action && GTK_IS_ACTION(action));
+ g_return_if_fail (window && GL_IS_WINDOW(window));
+
+ if (window->view != NULL) {
+ gl_view_rotate_selection_left (GL_VIEW(window->view));
+ }
+
+ gl_debug (DEBUG_COMMANDS, "END");
+}
+
+/*****************************************************************************/
+/** Objects/Rotate-right-90-degrees command. */
+/*****************************************************************************/
+void
+gl_ui_cmd_objects_rotate_right (GtkAction *action,
+ glWindow *window)
+
+{
+ gl_debug (DEBUG_COMMANDS, "START");
+
+ g_return_if_fail (action && GTK_IS_ACTION(action));
+ g_return_if_fail (window && GL_IS_WINDOW(window));
+
+ if (window->view != NULL) {
+ gl_view_rotate_selection_right (GL_VIEW(window->view));
+ }
+
+ gl_debug (DEBUG_COMMANDS, "END");
+}
+
+/*****************************************************************************/
+/** Objects/Flip-horizontally command. */
+/*****************************************************************************/
+void
+gl_ui_cmd_objects_flip_horiz (GtkAction *action,
+ glWindow *window)
+
+{
+ gl_debug (DEBUG_COMMANDS, "START");
+
+ g_return_if_fail (action && GTK_IS_ACTION(action));
+ g_return_if_fail (window && GL_IS_WINDOW(window));
+
+ if (window->view != NULL) {
+ gl_view_flip_selection_horiz (GL_VIEW(window->view));
+ }
+
+ gl_debug (DEBUG_COMMANDS, "END");
+}
+
+/*****************************************************************************/
+/** Objects/Flip-vertically command. */
+/*****************************************************************************/
+void
+gl_ui_cmd_objects_flip_vert (GtkAction *action,
+ glWindow *window)
+
+{
+ gl_debug (DEBUG_COMMANDS, "START");
+
+ g_return_if_fail (action && GTK_IS_ACTION(action));
+ g_return_if_fail (window && GL_IS_WINDOW(window));
+
+ if (window->view != NULL) {
+ gl_view_flip_selection_vert (GL_VIEW(window->view));
+ }
+
+ gl_debug (DEBUG_COMMANDS, "END");
+}
+
+/*****************************************************************************/
+/** Objects/Align-left command. */
+/*****************************************************************************/
+void
+gl_ui_cmd_objects_align_left (GtkAction *action,
+ glWindow *window)
+
+{
+ gl_debug (DEBUG_COMMANDS, "START");
+
+ g_return_if_fail (action && GTK_IS_ACTION(action));
+ g_return_if_fail (window && GL_IS_WINDOW(window));
+
+ if (window->view != NULL) {
+ gl_view_align_selection_left (GL_VIEW(window->view));
+ }
+
+ gl_debug (DEBUG_COMMANDS, "END");
+}
+
+/*****************************************************************************/
+/** Objects/Align-right command. */
+/*****************************************************************************/
+void
+gl_ui_cmd_objects_align_right (GtkAction *action,
+ glWindow *window)
+
+{
+ gl_debug (DEBUG_COMMANDS, "START");
+
+ g_return_if_fail (action && GTK_IS_ACTION(action));
+ g_return_if_fail (window && GL_IS_WINDOW(window));
+
+ if (window->view != NULL) {
+ gl_view_align_selection_right (GL_VIEW(window->view));
+ }
+
+ gl_debug (DEBUG_COMMANDS, "END");
+}
+
+/*****************************************************************************/
+/** Objects/Align-horizontal-center command. */
+/*****************************************************************************/
+void
+gl_ui_cmd_objects_align_hcenter (GtkAction *action,
+ glWindow *window)
+
+{
+ gl_debug (DEBUG_COMMANDS, "START");
+
+ g_return_if_fail (action && GTK_IS_ACTION(action));
+ g_return_if_fail (window && GL_IS_WINDOW(window));
+
+ if (window->view != NULL) {
+ gl_view_align_selection_hcenter (GL_VIEW(window->view));
+ }
+
+ gl_debug (DEBUG_COMMANDS, "END");
+}
+
+/*****************************************************************************/
+/** Objects/Align-top command. */
+/*****************************************************************************/
+void
+gl_ui_cmd_objects_align_top (GtkAction *action,
+ glWindow *window)
+
+{
+ gl_debug (DEBUG_COMMANDS, "START");
+
+ g_return_if_fail (action && GTK_IS_ACTION(action));
+ g_return_if_fail (window && GL_IS_WINDOW(window));
+
+ if (window->view != NULL) {
+ gl_view_align_selection_top (GL_VIEW(window->view));
+ }
+
+ gl_debug (DEBUG_COMMANDS, "END");
+}
+
+/*****************************************************************************/
+/** Objects/Align-bottom command. */
+/*****************************************************************************/
+void
+gl_ui_cmd_objects_align_bottom (GtkAction *action,
+ glWindow *window)
+
+{
+ gl_debug (DEBUG_COMMANDS, "START");
+
+ g_return_if_fail (action && GTK_IS_ACTION(action));
+ g_return_if_fail (window && GL_IS_WINDOW(window));
+
+ if (window->view != NULL) {
+ gl_view_align_selection_bottom (GL_VIEW(window->view));
+ }
+
+ gl_debug (DEBUG_COMMANDS, "END");
+}
+
+/*****************************************************************************/
+/** Objects/Align-vertical center command. */
+/*****************************************************************************/
+void
+gl_ui_cmd_objects_align_vcenter (GtkAction *action,
+ glWindow *window)
+
+{
+ gl_debug (DEBUG_COMMANDS, "START");
+
+ g_return_if_fail (action && GTK_IS_ACTION(action));
+ g_return_if_fail (window && GL_IS_WINDOW(window));
+
+ if (window->view != NULL) {
+ gl_view_align_selection_vcenter (GL_VIEW(window->view));
+ }
+
+ gl_debug (DEBUG_COMMANDS, "END");
+}
+
+/*****************************************************************************/
+/** Objects/Center-horizontally command. */
+/*****************************************************************************/
+void
+gl_ui_cmd_objects_center_horiz (GtkAction *action,
+ glWindow *window)
+
+{
+ gl_debug (DEBUG_COMMANDS, "START");
+
+ g_return_if_fail (action && GTK_IS_ACTION(action));
+ g_return_if_fail (window && GL_IS_WINDOW(window));
+
+ if (window->view != NULL) {
+ gl_view_center_selection_horiz (GL_VIEW(window->view));
+ }
+
+ gl_debug (DEBUG_COMMANDS, "END");
+}
+
+/*****************************************************************************/
+/** Objects/Center-vertically command. */
+/*****************************************************************************/
+void
+gl_ui_cmd_objects_center_vert (GtkAction *action,
+ glWindow *window)
+
+{
+ gl_debug (DEBUG_COMMANDS, "START");
+
+ g_return_if_fail (action && GTK_IS_ACTION(action));
+ g_return_if_fail (window && GL_IS_WINDOW(window));
+
+ if (window->view != NULL) {
+ gl_view_center_selection_vert (GL_VIEW(window->view));
+ }
+
+ gl_debug (DEBUG_COMMANDS, "END");
+}
+
+/*****************************************************************************/
+/** Objects/Edit- merge-properties command. */
+/*****************************************************************************/
+void
+gl_ui_cmd_objects_merge_properties (GtkAction *action,
+ glWindow *window)
+
+{
+ gl_debug (DEBUG_COMMANDS, "START");
+
+ g_return_if_fail (action && GTK_IS_ACTION(action));
+ g_return_if_fail (window && GL_IS_WINDOW(window));
+
+ if (window->view != NULL) {
+ gl_view_edit_merge_props (GL_VIEW(window->view));
+ }
+
+ gl_debug (DEBUG_COMMANDS, "END");
+}
+
+/****************************************************************************/
+/** Help/Contents command. */
+/****************************************************************************/
+void
+gl_ui_cmd_help_contents (GtkAction *action,
+ glWindow *window)
+{
+ GError *error = NULL;
+
+ gl_debug (DEBUG_COMMANDS, "START");
+
+ g_return_if_fail (action && GTK_IS_ACTION(action));
+ g_return_if_fail (window && GL_IS_WINDOW(window));
+
+ gnome_help_display_with_doc_id (NULL, NULL, "glabels.xml", NULL, &error);
+
+ if (error != NULL)
+ {
+ g_warning (error->message);
+
+ g_error_free (error);
+ }
+
+ gl_debug (DEBUG_COMMANDS, "END");
+}
+
+/*--------------------------------------------------------------------------*/
+/** Private: URL handler. */
+/*--------------------------------------------------------------------------*/
+static void
+activate_url (GtkAboutDialog *about,
+ const gchar *url,
+ gpointer data)
+{
+ gl_debug (DEBUG_COMMANDS, "START");
+
+ gnome_url_show (url, NULL);
+
+ gl_debug (DEBUG_COMMANDS, "END");
+}
+
+
+/****************************************************************************/
+/** Help/About command. */
+/****************************************************************************/
+void
+gl_ui_cmd_help_about (GtkAction *action,
+ glWindow *window)
+{
+ static GtkWidget *about = NULL;
+
+ GdkPixbuf *pixbuf = NULL;
+
+ const gchar *authors[] = {
+ "Jim Evins <evins@snaught.com>",
+ " ",
+ _("Glabels includes contributions from:"),
+ "Frederic Ruaudel <grumz@users.sf.net>",
+ "Wayne Schuller <k_wayne@linuxpower.org>",
+ "Emmanuel Pacaud <emmanuel.pacaud@univ-poitiers.fr>",
+ " ",
+ _("See the file AUTHORS for additional credits,"),
+ _("or visit http://glabels.sourceforge.net/"),
+ NULL
+ };
+
+ const gchar *artists[] = {
+ "Nestor Di <nestordi@usuarios.retecal.es>",
+ "Jim Evins <evins@snaught.com>",
+ NULL
+ };
+
+ const gchar *copy_text = "Copyright \xc2\xa9 2001-2005 Jim Evins";
+
+ const gchar *about_text = _("A label and business card creation program.\n");
+
+ const gchar *url = "http://glabels.sourceforge.net";
+
+ const gchar *translator_credits = _("translator-credits");
+
+ const gchar *license = _(
+ "Glabels is free software; you can redistribute it and/or modify it\n"
+ "under the terms of the GNU General Public License as published by\n"
+ "the Free Software Foundation; either version 2 of the License, or\n"
+ "(at your option) any later version.\n" "\n"
+ "This program is distributed in the hope that it will be useful, but\n"
+ "WITHOUT ANY WARRANTY; without even the implied warranty of\n"
+ "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See\n"
+ "the GNU General Public License for more details.\n");
+
+ gl_debug (DEBUG_COMMANDS, "START");
+
+ g_return_if_fail (action && GTK_IS_ACTION(action));
+ g_return_if_fail (window && GL_IS_WINDOW(window));
+
+ if (about != NULL)
+ {
+
+ gtk_window_set_transient_for (GTK_WINDOW (about),
+ GTK_WINDOW (window));
+ gtk_window_present (GTK_WINDOW (about));
+
+ } else {
+
+ pixbuf = gdk_pixbuf_new_from_file ( LOGO_PIXMAP, NULL);
+
+ gtk_about_dialog_set_url_hook (activate_url, NULL, NULL);
+
+ about = gtk_about_dialog_new ();
+ gtk_about_dialog_set_name (GTK_ABOUT_DIALOG(about), _("glabels"));
+ gtk_about_dialog_set_version (GTK_ABOUT_DIALOG(about), VERSION);
+ gtk_about_dialog_set_copyright (GTK_ABOUT_DIALOG(about), copy_text);
+ gtk_about_dialog_set_comments (GTK_ABOUT_DIALOG(about), about_text);
+ gtk_about_dialog_set_website (GTK_ABOUT_DIALOG(about), url);
+ gtk_about_dialog_set_logo (GTK_ABOUT_DIALOG(about), pixbuf);
+
+ gtk_about_dialog_set_authors (GTK_ABOUT_DIALOG(about), authors);
+ gtk_about_dialog_set_artists (GTK_ABOUT_DIALOG(about), artists);
+ gtk_about_dialog_set_translator_credits (GTK_ABOUT_DIALOG(about),
+ translator_credits);
+ gtk_about_dialog_set_license (GTK_ABOUT_DIALOG(about), license);
+
+ gtk_window_set_destroy_with_parent (GTK_WINDOW (about), TRUE);
+
+ g_signal_connect (G_OBJECT (about), "response",
+ G_CALLBACK (gtk_widget_destroy), NULL);
+ g_signal_connect (G_OBJECT (about), "destroy",
+ G_CALLBACK (gtk_widget_destroyed), &about);
+
+ gtk_window_set_transient_for (GTK_WINDOW (about),
+ GTK_WINDOW (window));
+
+ gtk_window_present (GTK_WINDOW (about));
+
+ if (pixbuf != NULL)
+ g_object_unref (pixbuf);
+
+ }
+
+ gl_debug (DEBUG_COMMANDS, "END");
+}
+
--- /dev/null
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/**
+ * (GLABELS) Label and Business Card Creation program for GNOME
+ *
+ * ui-commands.h: GLabels UI commands module header file
+ *
+ * Copyright (C) 2001-2005 Jim Evins <evins@snaught.com>.
+ *
+ * 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.
+ *
+ * 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
+ */
+
+#ifndef __COMMANDS_H__
+#define __COMMANDS_H__
+
+#include <gtk/gtkaction.h>
+#include <gtk/gtktoggleaction.h>
+#include "window.h"
+
+G_BEGIN_DECLS
+
+void gl_ui_cmd_file_new (GtkAction *action,
+ glWindow *window);
+
+void gl_ui_cmd_file_properties (GtkAction *action,
+ glWindow *window);
+
+void gl_ui_cmd_file_template_designer (GtkAction *action,
+ glWindow *window);
+
+void gl_ui_cmd_file_open (GtkAction *action,
+ glWindow *window);
+
+void gl_ui_cmd_file_open_recent (GtkAction *action,
+ glWindow *window);
+
+void gl_ui_cmd_file_save (GtkAction *action,
+ glWindow *window);
+
+void gl_ui_cmd_file_save_as (GtkAction *action,
+ glWindow *window);
+
+void gl_ui_cmd_file_print (GtkAction *action,
+ glWindow *window);
+
+void gl_ui_cmd_file_print_preview (GtkAction *action,
+ glWindow *window);
+
+void gl_ui_cmd_file_close (GtkAction *action,
+ glWindow *window);
+
+void gl_ui_cmd_file_quit (GtkAction *action,
+ glWindow *window);
+
+
+
+void gl_ui_cmd_edit_undo (GtkAction *action,
+ glWindow *window);
+
+void gl_ui_cmd_edit_redo (GtkAction *action,
+ glWindow *window);
+
+void gl_ui_cmd_edit_cut (GtkAction *action,
+ glWindow *window);
+
+void gl_ui_cmd_edit_copy (GtkAction *action,
+ glWindow *window);
+
+void gl_ui_cmd_edit_paste (GtkAction *action,
+ glWindow *window);
+
+void gl_ui_cmd_edit_delete (GtkAction *action,
+ glWindow *window);
+
+void gl_ui_cmd_edit_select_all (GtkAction *action,
+ glWindow *window);
+
+void gl_ui_cmd_edit_unselect_all (GtkAction *action,
+ glWindow *window);
+
+void gl_ui_cmd_edit_preferences (GtkAction *action,
+ glWindow *window);
+
+
+
+void gl_ui_cmd_view_property_bar_toggle (GtkToggleAction *action,
+ glWindow *window);
+
+void gl_ui_cmd_view_property_bar_tips_toggle (GtkToggleAction *action,
+ glWindow *window);
+
+void gl_ui_cmd_view_grid_toggle (GtkToggleAction *action,
+ glWindow *window);
+
+void gl_ui_cmd_view_markup_toggle (GtkToggleAction *action,
+ glWindow *window);
+
+
+
+void gl_ui_cmd_view_zoomin (GtkAction *action,
+ glWindow *window);
+
+void gl_ui_cmd_view_zoomout (GtkAction *action,
+ glWindow *window);
+
+void gl_ui_cmd_view_zoom1to1 (GtkAction *action,
+ glWindow *window);
+
+void gl_ui_cmd_view_zoom_to_fit (GtkAction *action,
+ glWindow *window);
+
+
+
+void gl_ui_cmd_objects_arrow_mode (GtkAction *action,
+ glWindow *window);
+
+void gl_ui_cmd_objects_create_text (GtkAction *action,
+ glWindow *window);
+
+void gl_ui_cmd_objects_create_box (GtkAction *action,
+ glWindow *window);
+
+void gl_ui_cmd_objects_create_line (GtkAction *action,
+ glWindow *window);
+
+void gl_ui_cmd_objects_create_ellipse (GtkAction *action,
+ glWindow *window);
+
+void gl_ui_cmd_objects_create_image (GtkAction *action,
+ glWindow *window);
+
+void gl_ui_cmd_objects_create_barcode (GtkAction *action,
+ glWindow *window);
+
+void gl_ui_cmd_objects_raise (GtkAction *action,
+ glWindow *window);
+
+void gl_ui_cmd_objects_lower (GtkAction *action,
+ glWindow *window);
+
+void gl_ui_cmd_objects_rotate_left (GtkAction *action,
+ glWindow *window);
+
+void gl_ui_cmd_objects_rotate_right (GtkAction *action,
+ glWindow *window);
+
+void gl_ui_cmd_objects_flip_horiz (GtkAction *action,
+ glWindow *window);
+
+void gl_ui_cmd_objects_flip_vert (GtkAction *action,
+ glWindow *window);
+
+void gl_ui_cmd_objects_align_left (GtkAction *action,
+ glWindow *window);
+
+void gl_ui_cmd_objects_align_right (GtkAction *action,
+ glWindow *window);
+
+void gl_ui_cmd_objects_align_hcenter (GtkAction *action,
+ glWindow *window);
+
+void gl_ui_cmd_objects_align_top (GtkAction *action,
+ glWindow *window);
+
+void gl_ui_cmd_objects_align_bottom (GtkAction *action,
+ glWindow *window);
+
+void gl_ui_cmd_objects_align_vcenter (GtkAction *action,
+ glWindow *window);
+
+void gl_ui_cmd_objects_center_horiz (GtkAction *action,
+ glWindow *window);
+
+void gl_ui_cmd_objects_center_vert (GtkAction *action,
+ glWindow *window);
+
+void gl_ui_cmd_objects_merge_properties (GtkAction *action,
+ glWindow *window);
+
+
+
+void gl_ui_cmd_help_contents (GtkAction *action,
+ glWindow *window);
+
+void gl_ui_cmd_help_about (GtkAction *action,
+ glWindow *window);
+
+G_END_DECLS
+
+#endif /* __COMMANDS_H__ */
-/*
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/**
* (GLABELS) Label and Business Card Creation program for GNOME
*
* property-bar.c: gLabels property bar
#include "ui-property-bar.h"
#include <glib/gi18n.h>
+#include <glade/glade-xml.h>
#include <gtk/gtkcombobox.h>
#include <gtk/gtkspinbutton.h>
+#include <gtk/gtktoolbar.h>
+#include <gtk/gtktoggletoolbutton.h>
#include <libgnomeprint/gnome-font.h>
+#include <gtk/gtktooltips.h>
-#include "ui-util.h"
+#include "util.h"
#include "mygal/widget-color-combo.h"
#include "stock-pixmaps/stockpixbufs.h"
#include "prefs.h"
/*============================================================================*/
/*============================================================================*/
-/* Private globals */
+/* Private data types */
/*============================================================================*/
-static GObjectClass *parent_class;
-
-static gchar* doc_verbs [] = {
- "/commands/PropFontName",
- "/commands/PropFontSize",
- "/commands/PropFontBold",
- "/commands/PropFontItalic",
- "/commands/PropTextAlignLeft",
- "/commands/PropTextAlignCenter",
- "/commands/PropTextAlignRight",
- "/commands/PropFillColor",
- "/commands/PropLineColor",
- "/commands/PropTextColor",
- "/commands/PropLineWidth",
-
- NULL
-};
+struct _glUIPropertyBarPrivate {
-static gchar* text_verbs [] = {
- "/commands/PropFontName",
- "/commands/PropFontSize",
- "/commands/PropFontBold",
- "/commands/PropFontItalic",
- "/commands/PropTextAlignLeft",
- "/commands/PropTextAlignCenter",
- "/commands/PropTextAlignRight",
- "/commands/PropTextColor",
-
- NULL
-};
+ glView *view;
-static gchar* fill_verbs [] = {
- "/commands/PropFillColor",
+ GladeXML *gui;
- NULL
-};
+ GtkWidget *tool_bar;
-static gchar* line_color_verbs [] = {
- "/commands/PropLineColor",
+ /* Font selection */
+ GtkWidget *font_family_combo;
+ GtkWidget *font_size_spin;
+ GtkWidget *font_bold_toggle;
+ GtkWidget *font_italic_toggle;
- NULL
-};
+ /* Text alignemnt radios */
+ GtkWidget *text_align_left_radio;
+ GtkWidget *text_align_center_radio;
+ GtkWidget *text_align_right_radio;
+
+ /* Color combos */
+ GtkWidget *text_color_combo;
+ GtkWidget *fill_color_combo;
+ GtkWidget *line_color_combo;
-static gchar* line_width_verbs [] = {
- "/commands/PropLineWidth",
+ /* Line width */
+ GtkWidget *line_width_spin;
+
+ gboolean stop_signals;
- NULL
};
+/*============================================================================*/
+/* Private globals */
+/*============================================================================*/
+
+static GtkHBoxClass *parent_class;
+
/*============================================================================*/
/* Local function prototypes */
/*============================================================================*/
static void gl_ui_property_bar_instance_init (glUIPropertyBar *property_bar);
static void gl_ui_property_bar_finalize (GObject *object);
-static void gl_ui_property_bar_construct (glUIPropertyBar *property_bar,
- BonoboUIComponent *ui_component);
+static void gl_ui_property_bar_construct (glUIPropertyBar *property_bar);
static void selection_changed_cb (glUIPropertyBar *property_bar);
static void line_width_changed_cb (GtkSpinButton *spin,
glUIPropertyBar *property_bar);
-static void prop_item_toggled_cb (BonoboUIComponent *ui_component,
- const char *path,
- Bonobo_UIComponent_EventType type,
- const char *state,
- glUIPropertyBar *property_bar);
+static void font_bold_toggled_cb (GtkToggleToolButton *toggle,
+ glUIPropertyBar *property_bar);
+
+static void font_italic_toggled_cb (GtkToggleToolButton *toggle,
+ glUIPropertyBar *property_bar);
+
+static void text_align_toggled_cb (GtkToggleToolButton *toggle,
+ glUIPropertyBar *property_bar);
+
+static void set_doc_items_sensitive (glUIPropertyBar *property_bar,
+ gboolean state);
-static void null_cmd (BonoboUIComponent *ui_component,
- gpointer user_data,
- const gchar *verbname);
+static void set_text_items_sensitive (glUIPropertyBar *property_bar,
+ gboolean state);
+static void set_fill_items_sensitive (glUIPropertyBar *property_bar,
+ gboolean state);
+static void set_line_color_items_sensitive (glUIPropertyBar *property_bar,
+ gboolean state);
+
+static void set_line_width_items_sensitive (glUIPropertyBar *property_bar,
+ gboolean state);
\f
/****************************************************************************/
NULL
};
- type = g_type_register_static (G_TYPE_OBJECT,
+ type = g_type_register_static (GTK_TYPE_HBOX,
"glUIPropertyBar", &info, 0);
}
{
gl_debug (DEBUG_PROPERTY_BAR, "START");
- property_bar->view = NULL;
+ property_bar->priv = g_new0 (glUIPropertyBarPrivate, 1);
+
+ property_bar->priv->gui = glade_xml_new (GLABELS_GLADE_DIR "property-bar.glade",
+ "property_toolbar",
+ NULL);
+
+ if (!property_bar->priv->gui) {
+ g_warning ("Could not open property-bar.glade, reinstall glabels!");
+ return;
+ }
gl_debug (DEBUG_PROPERTY_BAR, "END");
}
property_bar = GL_UI_PROPERTY_BAR (object);
- if (property_bar->view) {
- g_object_unref (G_OBJECT(property_bar->view));
- property_bar = NULL;
+ if (property_bar->priv->view) {
+ g_object_unref (G_OBJECT(property_bar->priv->view));
}
G_OBJECT_CLASS (parent_class)->finalize (object);
+ g_free (property_bar->priv);
+
gl_debug (DEBUG_PROPERTY_BAR, "END");
}
/****************************************************************************/
/* Create a NEW property_bar. */
/****************************************************************************/
-GObject *
-gl_ui_property_bar_new (BonoboUIComponent *ui_component)
+GtkWidget *
+gl_ui_property_bar_new (void)
{
glUIPropertyBar *property_bar;
gl_debug (DEBUG_PROPERTY_BAR, "START");
- property_bar = g_object_new (gl_ui_property_bar_get_type (), NULL);
+ property_bar = g_object_new (GL_TYPE_UI_PROPERTY_BAR, NULL);
- gl_ui_property_bar_construct (property_bar, ui_component);
+ gl_ui_property_bar_construct (property_bar);
gl_debug (DEBUG_PROPERTY_BAR, "END");
- return G_OBJECT(property_bar);
+ return GTK_WIDGET (property_bar);
}
/******************************************************************************/
/* Initialize property toolbar. */
/******************************************************************************/
static void
-gl_ui_property_bar_construct (glUIPropertyBar *property_bar,
- BonoboUIComponent *ui_component)
+gl_ui_property_bar_construct (glUIPropertyBar *property_bar)
{
- GtkWidget *wcombo;
GList *family_names = NULL;
GList *family_node;
- GtkObject *adjust;
- ColorGroup *cg;
- GdkPixbuf *pixbuf;
GdkColor *gdk_color;
gl_debug (DEBUG_PROPERTY_BAR, "START");
- property_bar->stop_signals = TRUE;
- property_bar->ui_component = ui_component;
+ property_bar->priv->stop_signals = TRUE;
+
+ property_bar->priv->tool_bar = glade_xml_get_widget (property_bar->priv->gui,
+ "property_toolbar");
+ gtk_container_add (GTK_CONTAINER (property_bar), property_bar->priv->tool_bar);
+
+ property_bar->priv->font_family_combo =
+ glade_xml_get_widget (property_bar->priv->gui, "font_family_combo");
+ property_bar->priv->font_size_spin =
+ glade_xml_get_widget (property_bar->priv->gui, "font_size_spin");
+ property_bar->priv->font_bold_toggle =
+ glade_xml_get_widget (property_bar->priv->gui, "font_bold_toggle");
+ property_bar->priv->font_italic_toggle =
+ glade_xml_get_widget (property_bar->priv->gui, "font_italic_toggle");
+ property_bar->priv->text_align_left_radio =
+ glade_xml_get_widget (property_bar->priv->gui, "text_align_left_radio");
+ property_bar->priv->text_align_center_radio =
+ glade_xml_get_widget (property_bar->priv->gui, "text_align_center_radio");
+ property_bar->priv->text_align_right_radio =
+ glade_xml_get_widget (property_bar->priv->gui, "text_align_right_radio");
+ property_bar->priv->text_color_combo =
+ glade_xml_get_widget (property_bar->priv->gui, "text_color_combo");
+ property_bar->priv->fill_color_combo =
+ glade_xml_get_widget (property_bar->priv->gui, "fill_color_combo");
+ property_bar->priv->line_color_combo =
+ glade_xml_get_widget (property_bar->priv->gui, "line_color_combo");
+ property_bar->priv->line_width_spin =
+ glade_xml_get_widget (property_bar->priv->gui, "line_width_spin");
+
+ set_doc_items_sensitive (property_bar, FALSE);
/* Font family entry widget */
- wcombo = gtk_combo_box_new_text ();
+ gl_util_combo_box_add_text_model (GTK_COMBO_BOX (property_bar->priv->font_family_combo));
family_names = gnome_font_family_list ();
- gl_util_combo_box_set_strings (GTK_COMBO_BOX (wcombo), family_names);
- property_bar->font_family_combo = wcombo;
- gtk_widget_set_size_request (wcombo, 200, -1);
+ gl_util_combo_box_set_strings (GTK_COMBO_BOX (property_bar->priv->font_family_combo),
+ family_names);
+ gtk_widget_set_size_request (property_bar->priv->font_family_combo, 200, -1);
/* Make sure we have a valid font. if not provide a good default. */
family_node = g_list_find_custom (family_names,
gl_prefs->default_font_family,
(GCompareFunc)g_utf8_collate);
if (family_node) {
- gtk_combo_box_set_active (GTK_COMBO_BOX (wcombo),
+ gtk_combo_box_set_active (GTK_COMBO_BOX (property_bar->priv->font_family_combo),
g_list_position (family_names,
family_node));
} else {
- gtk_combo_box_set_active (GTK_COMBO_BOX (wcombo), 0);
+ gtk_combo_box_set_active (GTK_COMBO_BOX (property_bar->priv->font_family_combo), 0);
}
gnome_font_family_list_free (family_names);
- g_signal_connect (G_OBJECT (property_bar->font_family_combo),
+ g_signal_connect (G_OBJECT (property_bar->priv->font_family_combo),
"changed", G_CALLBACK (font_family_changed_cb), property_bar);
- gl_ui_util_insert_widget (ui_component, wcombo, "/PropertyToolbar/PropFontName");
-
/* Font size entry widget */
- adjust = gtk_adjustment_new (1.0, 1.0, 250.0, 1.0, 10.0, 10.0);
- property_bar->font_size_spin = gtk_spin_button_new (GTK_ADJUSTMENT (adjust),
- 1.0, 0);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON(property_bar->font_size_spin),
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON(property_bar->priv->font_size_spin),
gl_prefs->default_font_size);
- g_signal_connect (G_OBJECT (property_bar->font_size_spin),
+ g_signal_connect (G_OBJECT (property_bar->priv->font_size_spin),
"changed", G_CALLBACK (font_size_changed_cb), property_bar);
- gl_ui_util_insert_widget (ui_component, property_bar->font_size_spin,
- "/PropertyToolbar/PropFontSize");
/* Bold and Italic toggles */
- bonobo_ui_component_add_verb (ui_component, "PropFontBold", null_cmd, NULL);
- gl_ui_util_set_verb_state (ui_component, "/commands/PropFontBold",
- (gl_prefs->default_font_weight == GNOME_FONT_BOLD));
- bonobo_ui_component_add_listener (ui_component, "PropFontBold",
- (BonoboUIListenerFn)prop_item_toggled_cb,
- (gpointer)property_bar);
- bonobo_ui_component_add_verb (ui_component, "PropFontItalic", null_cmd, NULL);
- gl_ui_util_set_verb_state (ui_component, "/commands/PropFontItalic",
- gl_prefs->default_font_italic_flag);
- bonobo_ui_component_add_listener (ui_component, "PropFontItalic",
- (BonoboUIListenerFn)prop_item_toggled_cb,
- (gpointer)property_bar);
+ gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (property_bar->priv->font_bold_toggle),
+ (gl_prefs->default_font_weight == GNOME_FONT_BOLD));
+ g_signal_connect (G_OBJECT (property_bar->priv->font_bold_toggle),
+ "toggled", G_CALLBACK (font_bold_toggled_cb), property_bar);
+ gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (property_bar->priv->font_italic_toggle),
+ gl_prefs->default_font_italic_flag);
+ g_signal_connect (G_OBJECT (property_bar->priv->font_italic_toggle),
+ "toggled", G_CALLBACK (font_italic_toggled_cb), property_bar);
+
/* Text alignment radio group */
- bonobo_ui_component_add_verb (ui_component, "PropTextAlignLeft", null_cmd, NULL);
- gl_ui_util_set_verb_state (ui_component, "/commands/PropTextAlignLeft",
- (gl_prefs->default_text_alignment == GTK_JUSTIFY_LEFT));
- bonobo_ui_component_add_listener (ui_component, "PropTextAlignLeft",
- (BonoboUIListenerFn)prop_item_toggled_cb,
- (gpointer)property_bar);
- bonobo_ui_component_add_verb (ui_component, "PropTextAlignCenter", null_cmd, NULL);
- gl_ui_util_set_verb_state (ui_component, "/commands/PropTextAlignCenter",
- (gl_prefs->default_text_alignment == GTK_JUSTIFY_CENTER));
- bonobo_ui_component_add_listener (ui_component, "PropTextAlignCenter",
- (BonoboUIListenerFn)prop_item_toggled_cb,
- (gpointer)property_bar);
- bonobo_ui_component_add_verb (ui_component, "PropTextAlignRight", null_cmd, NULL);
- gl_ui_util_set_verb_state (ui_component, "/commands/PropTextAlignRight",
- (gl_prefs->default_text_alignment == GTK_JUSTIFY_RIGHT));
- bonobo_ui_component_add_listener (ui_component, "PropTextAlignRight",
- (BonoboUIListenerFn)prop_item_toggled_cb,
- (gpointer)property_bar);
+ gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (property_bar->priv->text_align_left_radio),
+ (gl_prefs->default_text_alignment == GTK_JUSTIFY_LEFT));
+ g_signal_connect (G_OBJECT (property_bar->priv->text_align_left_radio),
+ "toggled", G_CALLBACK (text_align_toggled_cb), property_bar);
+ gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (property_bar->priv->text_align_center_radio),
+ (gl_prefs->default_text_alignment == GTK_JUSTIFY_CENTER));
+ g_signal_connect (G_OBJECT (property_bar->priv->text_align_center_radio),
+ "toggled", G_CALLBACK (text_align_toggled_cb), property_bar);
+ gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (property_bar->priv->text_align_right_radio),
+ (gl_prefs->default_text_alignment == GTK_JUSTIFY_RIGHT));
+ g_signal_connect (G_OBJECT (property_bar->priv->text_align_right_radio),
+ "toggled", G_CALLBACK (text_align_toggled_cb), property_bar);
/* Text color widget */
- cg = color_group_fetch ("text_color_group", NULL);
- pixbuf = gdk_pixbuf_new_from_inline (-1, stock_text_24, FALSE, NULL);
gdk_color = gl_color_to_gdk_color (gl_prefs->default_text_color);
- property_bar->text_color_combo = color_combo_new (pixbuf, _("Default"),
- gdk_color, cg);
+ color_combo_set_color (COLOR_COMBO (property_bar->priv->text_color_combo), gdk_color);
g_free (gdk_color);
-
- g_signal_connect (G_OBJECT (property_bar->text_color_combo),
+ g_signal_connect (G_OBJECT (property_bar->priv->text_color_combo),
"color_changed",
G_CALLBACK (text_color_changed_cb), property_bar);
- gl_ui_util_insert_widget (ui_component, property_bar->text_color_combo,
- "/PropertyToolbar/PropTextColor");
-
/* Fill color widget */
- cg = color_group_fetch ("fill_color_group", NULL);
- pixbuf = gdk_pixbuf_new_from_inline (-1, stock_bucket_fill_24, FALSE, NULL);
gdk_color = gl_color_to_gdk_color (gl_prefs->default_fill_color);
- property_bar->fill_color_combo = color_combo_new (pixbuf, _("No fill"),
- gdk_color, cg);
+ color_combo_set_color (COLOR_COMBO (property_bar->priv->fill_color_combo), gdk_color);
g_free (gdk_color);
-
- g_signal_connect (G_OBJECT (property_bar->fill_color_combo),
+ g_signal_connect (G_OBJECT (property_bar->priv->fill_color_combo),
"color_changed",
G_CALLBACK (fill_color_changed_cb), property_bar);
- gl_ui_util_insert_widget (ui_component, property_bar->fill_color_combo,
- "/PropertyToolbar/PropFillColor");
-
/* Line color widget */
- cg = color_group_fetch ("line_color_group", NULL);
- pixbuf = gdk_pixbuf_new_from_inline (-1, stock_pencil_24, FALSE, NULL);
gdk_color = gl_color_to_gdk_color (gl_prefs->default_line_color);
- property_bar->line_color_combo = color_combo_new (pixbuf, _("No line"),
- gdk_color, cg);
+ color_combo_set_color (COLOR_COMBO (property_bar->priv->line_color_combo), gdk_color);
g_free (gdk_color);
-
- g_signal_connect (G_OBJECT (property_bar->line_color_combo),
+ g_signal_connect (G_OBJECT (property_bar->priv->line_color_combo),
"color_changed",
G_CALLBACK (line_color_changed_cb), property_bar);
- gl_ui_util_insert_widget (ui_component, property_bar->line_color_combo,
- "/PropertyToolbar/PropLineColor");
-
/* Line width entry widget */
- adjust = gtk_adjustment_new (1.0, 0.25, 4.0, 0.25, 1.0, 1.0);
- property_bar->line_width_spin = gtk_spin_button_new (GTK_ADJUSTMENT (adjust), 0.25, 2);
-
- g_signal_connect (G_OBJECT (property_bar->line_width_spin),
+ g_signal_connect (G_OBJECT (property_bar->priv->line_width_spin),
"changed",
G_CALLBACK (line_width_changed_cb), property_bar);
- gl_ui_util_insert_widget (ui_component, property_bar->line_width_spin,
- "/PropertyToolbar/PropLineWidth");
-
- gl_ui_util_set_verb_list_sensitive (ui_component, doc_verbs, FALSE);
-
- property_bar->stop_signals = FALSE;
+ property_bar->priv->stop_signals = FALSE;
gl_debug (DEBUG_PROPERTY_BAR, "END");
}
good_font_family = NULL;
}
}
- gl_util_combo_box_set_active_text (GTK_COMBO_BOX (property_bar->font_family_combo),
+ gl_util_combo_box_set_active_text (GTK_COMBO_BOX (property_bar->priv->font_family_combo),
good_font_family);
g_free (good_font_family);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON(property_bar->font_size_spin),
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON(property_bar->priv->font_size_spin),
view->default_font_size);
- gl_ui_util_set_verb_state (property_bar->ui_component,
- "/commands/PropFontBold",
- (view->default_font_weight == GNOME_FONT_BOLD));
- gl_ui_util_set_verb_state (property_bar->ui_component,
- "/commands/PropFontItalic",
- view->default_font_italic_flag);
-
- gl_ui_util_set_verb_state (property_bar->ui_component,
- "/commands/PropTextAlignLeft",
- (view->default_text_alignment == GTK_JUSTIFY_LEFT));
- gl_ui_util_set_verb_state (property_bar->ui_component,
- "/commands/PropTextAlignCenter",
- (view->default_text_alignment == GTK_JUSTIFY_CENTER));
- gl_ui_util_set_verb_state (property_bar->ui_component,
- "/commands/PropTextAlignRight",
- (view->default_text_alignment == GTK_JUSTIFY_RIGHT));
+ gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (property_bar->priv->font_bold_toggle),
+ (view->default_font_weight == GNOME_FONT_BOLD));
+ gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (property_bar->priv->font_italic_toggle),
+ view->default_font_italic_flag);
+
+ gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (property_bar->priv->text_align_left_radio),
+ (view->default_text_alignment == GTK_JUSTIFY_LEFT));
+ gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (property_bar->priv->text_align_center_radio),
+ (view->default_text_alignment == GTK_JUSTIFY_CENTER));
+ gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (property_bar->priv->text_align_right_radio),
+ (view->default_text_alignment == GTK_JUSTIFY_RIGHT));
gdk_color = gl_color_to_gdk_color (view->default_text_color);
- color_combo_set_color (COLOR_COMBO(property_bar->text_color_combo), gdk_color);
+ color_combo_set_color (COLOR_COMBO(property_bar->priv->text_color_combo), gdk_color);
g_free (gdk_color);
gdk_color = gl_color_to_gdk_color (view->default_fill_color);
- color_combo_set_color (COLOR_COMBO(property_bar->fill_color_combo), gdk_color);
+ color_combo_set_color (COLOR_COMBO(property_bar->priv->fill_color_combo), gdk_color);
g_free (gdk_color);
gdk_color = gl_color_to_gdk_color (view->default_line_color);
- color_combo_set_color (COLOR_COMBO(property_bar->line_color_combo), gdk_color);
+ color_combo_set_color (COLOR_COMBO(property_bar->priv->line_color_combo), gdk_color);
g_free (gdk_color);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON(property_bar->line_width_spin),
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON(property_bar->priv->line_width_spin),
view->default_line_width);
}
label = view->label;
g_return_if_fail (label && GL_IS_LABEL (label));
- gl_ui_util_set_verb_list_sensitive (property_bar->ui_component, doc_verbs, TRUE);
+ set_doc_items_sensitive (property_bar, TRUE);
- property_bar->view = GL_VIEW (g_object_ref (G_OBJECT (view)));
+ property_bar->priv->view = GL_VIEW (g_object_ref (G_OBJECT (view)));
reset_to_default_properties (view, property_bar);
gl_debug (DEBUG_PROPERTY_BAR, "END");
}
+/****************************************************************************/
+/** Set visiblity of property bar's tooltips. */
+/****************************************************************************/
+void
+gl_ui_property_bar_set_tooltips (glUIPropertyBar *property_bar,
+ gboolean state)
+{
+ GtkTooltipsData *data;
+
+ gl_debug (DEBUG_PROPERTY_BAR, "START");
+
+ g_return_if_fail (property_bar && GL_IS_UI_PROPERTY_BAR(property_bar));
+
+ /* HACK: peek into one of our widgets to get the tooltips group created by libglade. */
+ data = gtk_tooltips_data_get (property_bar->priv->font_size_spin);
+ g_return_if_fail (data);
+
+ if (state) {
+ gtk_tooltips_enable (data->tooltips);
+ } else {
+ gtk_tooltips_disable (data->tooltips);
+ }
+
+ gl_debug (DEBUG_PROPERTY_BAR, "END");
+}
+
/*---------------------------------------------------------------------------*/
/* PRIVATE. View "selection state changed" callback. */
/*---------------------------------------------------------------------------*/
-
static void
update_text_properties (glView *view,
glUIPropertyBar *property_bar)
GdkColor *gdk_color;
can_text = gl_view_can_selection_text (view);
- gl_ui_util_set_verb_list_sensitive (property_bar->ui_component,
- text_verbs,
- can_text);
+ set_text_items_sensitive (property_bar, can_text);
+
if (!can_text)
return;
if (is_same_font_family && (selection_font_family != NULL))
gl_debug (DEBUG_PROPERTY_BAR, "same font family = %s",
selection_font_family);
- gl_util_combo_box_set_active_text (GTK_COMBO_BOX (property_bar->font_family_combo),
+ gl_util_combo_box_set_active_text (GTK_COMBO_BOX (property_bar->priv->font_family_combo),
is_same_font_family?selection_font_family:"");
g_free (selection_font_family);
if (is_same_font_size) {
gl_debug (DEBUG_PROPERTY_BAR, "same font size = %g",
selection_font_size);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (property_bar->font_size_spin),
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (property_bar->priv->font_size_spin),
selection_font_size);
} else {
- gtk_entry_set_text (GTK_ENTRY (property_bar->font_size_spin), "");
+ gtk_entry_set_text (GTK_ENTRY (property_bar->priv->font_size_spin), "");
}
if (is_same_text_color) {
gl_debug (DEBUG_PROPERTY_BAR, "same text color = %08x", selection_text_color);
gdk_color = gl_color_to_gdk_color (selection_text_color);
- color_combo_set_color (COLOR_COMBO (property_bar->text_color_combo),
+ color_combo_set_color (COLOR_COMBO (property_bar->priv->text_color_combo),
gdk_color);
g_free (gdk_color);
}
if (is_same_is_italic)
gl_debug (DEBUG_PROPERTY_BAR, "same italic flag = %d",
selection_is_italic);
- gl_ui_util_set_verb_state (property_bar->ui_component,
- "/commands/PropFontItalic",
- selection_is_italic && is_same_is_italic);
+ gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (property_bar->priv->font_italic_toggle),
+ selection_is_italic && is_same_is_italic);
if (is_same_is_bold)
gl_debug (DEBUG_PROPERTY_BAR, "same bold flag = %d",
selection_is_bold);
- gl_ui_util_set_verb_state (property_bar->ui_component,
- "/commands/PropFontBold",
- selection_is_bold && is_same_is_bold);
+ gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (property_bar->priv->font_bold_toggle),
+ selection_is_bold && is_same_is_bold);
if (is_same_justification)
gl_debug (DEBUG_PROPERTY_BAR, "same justification");
- gl_ui_util_set_verb_state (property_bar->ui_component,
- "/commands/PropTextAlignRight",
- (selection_justification == GTK_JUSTIFY_RIGHT) &&
- is_same_justification);
- gl_ui_util_set_verb_state (property_bar->ui_component,
- "/commands/PropTextAlignLeft",
- (selection_justification == GTK_JUSTIFY_LEFT) &&
- is_same_justification);
- gl_ui_util_set_verb_state (property_bar->ui_component,
- "/commands/PropTextAlignCenter",
- (selection_justification == GTK_JUSTIFY_CENTER) &&
- is_same_justification);
+ gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (property_bar->priv->text_align_left_radio),
+ (selection_justification == GTK_JUSTIFY_LEFT) &&
+ is_same_justification);
+ gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (property_bar->priv->text_align_center_radio),
+ (selection_justification == GTK_JUSTIFY_CENTER) &&
+ is_same_justification);
+ gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (property_bar->priv->text_align_right_radio),
+ (selection_justification == GTK_JUSTIFY_RIGHT) &&
+ is_same_justification);
}
static void
glColorNode *fill_color_node;
can = gl_view_can_selection_fill (view);
- gl_ui_util_set_verb_list_sensitive (property_bar->ui_component,
- fill_verbs,
- can);
+ set_fill_items_sensitive (property_bar, can);
+
if (!can)
return;
if (is_same_fill_color) {
gl_debug (DEBUG_PROPERTY_BAR, "same fill color = %08x", selection_fill_color);
gdk_color = gl_color_to_gdk_color (selection_fill_color);
- color_combo_set_color (COLOR_COMBO (property_bar->fill_color_combo),
+ color_combo_set_color (COLOR_COMBO (property_bar->priv->fill_color_combo),
gdk_color);
g_free (gdk_color);
}
GdkColor *gdk_color;
can = gl_view_can_selection_line_color (view);
- gl_ui_util_set_verb_list_sensitive (property_bar->ui_component,
- line_color_verbs,
- can);
+ set_line_color_items_sensitive (property_bar, can);
+
if (!can)
return;
if (is_same_line_color) {
gl_debug (DEBUG_PROPERTY_BAR, "same line color = %08x", selection_line_color);
gdk_color = gl_color_to_gdk_color (selection_line_color);
- color_combo_set_color (COLOR_COMBO (property_bar->line_color_combo),
+ color_combo_set_color (COLOR_COMBO (property_bar->priv->line_color_combo),
gdk_color);
g_free (gdk_color);
}
gdouble selection_line_width, line_width;
can = gl_view_can_selection_line_width (view);
- gl_ui_util_set_verb_list_sensitive (property_bar->ui_component,
- line_width_verbs,
- can);
+ set_line_width_items_sensitive (property_bar, can);
+
if (!can)
return;
if (is_same_line_width) {
gl_debug (DEBUG_PROPERTY_BAR, "same line width = %g", selection_line_width);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (property_bar->line_width_spin),
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (property_bar->priv->line_width_spin),
selection_line_width);
} else {
- gtk_entry_set_text (GTK_ENTRY (property_bar->line_width_spin), "");
+ gtk_entry_set_text (GTK_ENTRY (property_bar->priv->line_width_spin), "");
}
}
static void
selection_changed_cb (glUIPropertyBar *property_bar)
{
- glView *view = property_bar->view;
+ glView *view = property_bar->priv->view;
gl_debug (DEBUG_PROPERTY_BAR, "START");
g_return_if_fail (view && GL_IS_VIEW (view));
g_return_if_fail (property_bar && GL_IS_UI_PROPERTY_BAR (property_bar));
- property_bar->stop_signals = TRUE;
+ property_bar->priv->stop_signals = TRUE;
if (gl_view_is_selection_empty (view)) {
/* No selection: make all controls active. */
reset_to_default_properties (view, property_bar);
- gl_ui_util_set_verb_list_sensitive (property_bar->ui_component,
- doc_verbs, TRUE);
+ set_doc_items_sensitive (property_bar, TRUE);
} else {
}
- property_bar->stop_signals = FALSE;
+ property_bar->priv->stop_signals = FALSE;
gl_debug (DEBUG_PROPERTY_BAR, "END");
}
{
gchar *font_family;
- if (property_bar->stop_signals)
+ if (property_bar->priv->stop_signals)
return;
gl_debug (DEBUG_PROPERTY_BAR, "START");
- g_signal_handlers_block_by_func (G_OBJECT(property_bar->view->label),
+ g_signal_handlers_block_by_func (G_OBJECT(property_bar->priv->view->label),
selection_changed_cb,
property_bar);
font_family = gtk_combo_box_get_active_text (GTK_COMBO_BOX (combo));
if ( strlen(font_family) ) {
- gl_view_set_selection_font_family (property_bar->view,
+ gl_view_set_selection_font_family (property_bar->priv->view,
font_family);
- gl_view_set_default_font_family (property_bar->view,
+ gl_view_set_default_font_family (property_bar->priv->view,
font_family);
}
g_free (font_family);
- g_signal_handlers_unblock_by_func (G_OBJECT(property_bar->view->label),
+ g_signal_handlers_unblock_by_func (G_OBJECT(property_bar->priv->view->label),
selection_changed_cb,
property_bar);
{
gdouble font_size;
- if (property_bar->stop_signals)
+ if (property_bar->priv->stop_signals)
return;
gl_debug (DEBUG_PROPERTY_BAR, "START");
- g_signal_handlers_block_by_func (G_OBJECT(property_bar->view->label),
+ g_signal_handlers_block_by_func (G_OBJECT(property_bar->priv->view->label),
selection_changed_cb,
property_bar);
font_size = gtk_spin_button_get_value (spin);
- gl_view_set_selection_font_size (property_bar->view,
+ gl_view_set_selection_font_size (property_bar->priv->view,
font_size);
- gl_view_set_default_font_size (property_bar->view,
+ gl_view_set_default_font_size (property_bar->priv->view,
font_size);
- g_signal_handlers_unblock_by_func (G_OBJECT(property_bar->view->label),
+ g_signal_handlers_unblock_by_func (G_OBJECT(property_bar->priv->view->label),
selection_changed_cb,
property_bar);
{
glColorNode *text_color_node;
- if (property_bar->stop_signals)
+ if (property_bar->priv->stop_signals)
return;
g_return_if_fail (property_bar && GL_IS_UI_PROPERTY_BAR (property_bar));
gl_debug (DEBUG_PROPERTY_BAR, "START");
- g_signal_handlers_block_by_func (G_OBJECT(property_bar->view->label),
+ g_signal_handlers_block_by_func (G_OBJECT(property_bar->priv->view->label),
selection_changed_cb,
property_bar);
if (is_default) {
text_color_node->color = gl_prefs->default_text_color;
- gl_view_set_selection_text_color (property_bar->view,
+ gl_view_set_selection_text_color (property_bar->priv->view,
text_color_node);
- gl_view_set_default_text_color (property_bar->view,
+ gl_view_set_default_text_color (property_bar->priv->view,
gl_prefs->default_text_color);
} else {
- gl_view_set_selection_text_color (property_bar->view,
+ gl_view_set_selection_text_color (property_bar->priv->view,
text_color_node);
- gl_view_set_default_text_color (property_bar->view,
+ gl_view_set_default_text_color (property_bar->priv->view,
text_color_node->color);
}
gl_color_node_free (&text_color_node);
- g_signal_handlers_unblock_by_func (G_OBJECT(property_bar->view->label),
+ g_signal_handlers_unblock_by_func (G_OBJECT(property_bar->priv->view->label),
selection_changed_cb,
property_bar);
{
glColorNode *fill_color_node;
- if (property_bar->stop_signals)
+ if (property_bar->priv->stop_signals)
return;
g_return_if_fail (property_bar && GL_IS_UI_PROPERTY_BAR (property_bar));
gl_debug (DEBUG_PROPERTY_BAR, "START");
- g_signal_handlers_block_by_func (G_OBJECT(property_bar->view->label),
+ g_signal_handlers_block_by_func (G_OBJECT(property_bar->priv->view->label),
selection_changed_cb,
property_bar);
if (is_default) {
fill_color_node->color = GL_COLOR_NONE;
- gl_view_set_selection_fill_color (property_bar->view,
+ gl_view_set_selection_fill_color (property_bar->priv->view,
fill_color_node);
- gl_view_set_default_fill_color (property_bar->view,
+ gl_view_set_default_fill_color (property_bar->priv->view,
fill_color_node->color);
} else {
- gl_view_set_selection_fill_color (property_bar->view,
+ gl_view_set_selection_fill_color (property_bar->priv->view,
fill_color_node);
- gl_view_set_default_fill_color (property_bar->view,
+ gl_view_set_default_fill_color (property_bar->priv->view,
fill_color_node->color);
}
gl_color_node_free (&fill_color_node);
- g_signal_handlers_unblock_by_func (G_OBJECT(property_bar->view->label),
+ g_signal_handlers_unblock_by_func (G_OBJECT(property_bar->priv->view->label),
selection_changed_cb,
property_bar);
{
glColorNode *line_color_node;
- if (property_bar->stop_signals)
+ if (property_bar->priv->stop_signals)
return;
g_return_if_fail (property_bar && GL_IS_UI_PROPERTY_BAR (property_bar));
gl_debug (DEBUG_PROPERTY_BAR, "START");
- g_signal_handlers_block_by_func (G_OBJECT(property_bar->view->label),
+ g_signal_handlers_block_by_func (G_OBJECT(property_bar->priv->view->label),
selection_changed_cb,
property_bar);
if (is_default) {
line_color_node->color = GL_COLOR_NONE;
- gl_view_set_selection_line_color (property_bar->view,
+ gl_view_set_selection_line_color (property_bar->priv->view,
line_color_node);
- gl_view_set_default_line_color (property_bar->view,
+ gl_view_set_default_line_color (property_bar->priv->view,
line_color_node->color);
} else {
- gl_view_set_selection_line_color (property_bar->view,
+ gl_view_set_selection_line_color (property_bar->priv->view,
line_color_node);
- gl_view_set_default_line_color (property_bar->view,
+ gl_view_set_default_line_color (property_bar->priv->view,
line_color_node->color);
}
gl_color_node_free (&line_color_node);
- g_signal_handlers_unblock_by_func (G_OBJECT(property_bar->view->label),
+ g_signal_handlers_unblock_by_func (G_OBJECT(property_bar->priv->view->label),
selection_changed_cb,
property_bar);
{
gdouble line_width;
- if (property_bar->stop_signals)
+ if (property_bar->priv->stop_signals)
return;
gl_debug (DEBUG_PROPERTY_BAR, "START");
- g_signal_handlers_block_by_func (G_OBJECT(property_bar->view->label),
+ if (property_bar->priv->view) {
+
+ g_signal_handlers_block_by_func (G_OBJECT(property_bar->priv->view->label),
+ selection_changed_cb,
+ property_bar);
+
+ line_width = gtk_spin_button_get_value (spin);
+
+ gl_view_set_selection_line_width (property_bar->priv->view,
+ line_width);
+ gl_view_set_default_line_width (property_bar->priv->view,
+ line_width);
+
+ g_signal_handlers_unblock_by_func (G_OBJECT(property_bar->priv->view->label),
+ selection_changed_cb,
+ property_bar);
+
+ }
+
+ gl_debug (DEBUG_PROPERTY_BAR, "END");
+}
+
+/*---------------------------------------------------------------------------*/
+/* PRIVATE. Font bold toggled callback. */
+/*---------------------------------------------------------------------------*/
+static void
+font_bold_toggled_cb (GtkToggleToolButton *toggle,
+ glUIPropertyBar *property_bar)
+{
+ gboolean state;
+ GnomeFontWeight weight;
+
+
+ if (property_bar->priv->stop_signals)
+ return;
+
+ gl_debug (DEBUG_PROPERTY_BAR, "START");
+
+ g_signal_handlers_block_by_func (G_OBJECT(property_bar->priv->view->label),
selection_changed_cb,
property_bar);
- line_width = gtk_spin_button_get_value (spin);
+ state = gtk_toggle_tool_button_get_active (toggle);
- gl_view_set_selection_line_width (property_bar->view,
- line_width);
- gl_view_set_default_line_width (property_bar->view,
- line_width);
+ weight = state ? GNOME_FONT_BOLD : GNOME_FONT_BOOK;
- g_signal_handlers_unblock_by_func (G_OBJECT(property_bar->view->label),
+ gl_view_set_selection_font_weight (property_bar->priv->view, weight);
+ gl_view_set_default_font_weight (property_bar->priv->view, weight);
+
+ g_signal_handlers_unblock_by_func (G_OBJECT(property_bar->priv->view->label),
selection_changed_cb,
property_bar);
gl_debug (DEBUG_PROPERTY_BAR, "END");
}
-
+
/*---------------------------------------------------------------------------*/
-/* PRIVATE. Property bar item toggled callback. */
+/* PRIVATE. Font italic toggled callback. */
/*---------------------------------------------------------------------------*/
static void
-prop_item_toggled_cb (BonoboUIComponent *ui_component,
- const char *path,
- Bonobo_UIComponent_EventType type,
- const char *state,
- glUIPropertyBar *property_bar)
+font_italic_toggled_cb (GtkToggleToolButton *toggle,
+ glUIPropertyBar *property_bar)
{
- gboolean s;
+ gboolean state;
- if (property_bar->stop_signals)
+ if (property_bar->priv->stop_signals)
return;
- gl_debug (DEBUG_PROPERTY_BAR, "");
+ gl_debug (DEBUG_PROPERTY_BAR, "START");
- g_signal_handlers_block_by_func (G_OBJECT(property_bar->view->label),
+ g_signal_handlers_block_by_func (G_OBJECT(property_bar->priv->view->label),
selection_changed_cb,
property_bar);
- s = (strcmp (state, "1") == 0);
+ state = gtk_toggle_tool_button_get_active (toggle);
- /*
- * Font properties: Bold & Italic
- */
- if (strcmp (path, "PropFontBold") == 0)
- {
- GnomeFontWeight weight = s ? GNOME_FONT_BOLD : GNOME_FONT_BOOK;
+ gl_view_set_selection_font_italic_flag (property_bar->priv->view, state);
+ gl_view_set_default_font_italic_flag (property_bar->priv->view, state);
- gl_view_set_selection_font_weight (property_bar->view, weight);
- gl_view_set_default_font_weight (property_bar->view, weight);
- }
+ g_signal_handlers_unblock_by_func (G_OBJECT(property_bar->priv->view->label),
+ selection_changed_cb,
+ property_bar);
- if (strcmp (path, "PropFontItalic") == 0)
- {
- gl_view_set_selection_font_italic_flag (property_bar->view, s);
- gl_view_set_default_font_italic_flag (property_bar->view, s);
- }
+ gl_debug (DEBUG_PROPERTY_BAR, "END");
+}
+
+/*---------------------------------------------------------------------------*/
+/* PRIVATE. Text align toggled callback. */
+/*---------------------------------------------------------------------------*/
+static void
+text_align_toggled_cb (GtkToggleToolButton *toggle,
+ glUIPropertyBar *property_bar)
+{
+ if (property_bar->priv->stop_signals)
+ return;
+ gl_debug (DEBUG_PROPERTY_BAR, "START");
- /*
- * Text alignment group
- */
- if (s && (strcmp (path, "PropTextAlignLeft") == 0))
+ g_signal_handlers_block_by_func (G_OBJECT(property_bar->priv->view->label),
+ selection_changed_cb,
+ property_bar);
+
+ if (gtk_toggle_tool_button_get_active (GTK_TOGGLE_TOOL_BUTTON (property_bar->priv->text_align_left_radio)))
{
- gl_view_set_selection_text_alignment (property_bar->view,
+ gl_view_set_selection_text_alignment (property_bar->priv->view,
GTK_JUSTIFY_LEFT);
- gl_view_set_default_text_alignment (property_bar->view,
+ gl_view_set_default_text_alignment (property_bar->priv->view,
GTK_JUSTIFY_LEFT);
-
- /* Adjust state of siblings */
- gl_ui_util_set_verb_state (ui_component,
- "/commands/PropTextAlignCenter",
- FALSE);
- gl_ui_util_set_verb_state (ui_component,
- "/commands/PropTextAlignRight",
- FALSE);
}
- if (s && (strcmp (path, "PropTextAlignCenter") == 0))
+ if (gtk_toggle_tool_button_get_active (GTK_TOGGLE_TOOL_BUTTON (property_bar->priv->text_align_center_radio)))
{
- gl_view_set_selection_text_alignment (property_bar->view,
+ gl_view_set_selection_text_alignment (property_bar->priv->view,
GTK_JUSTIFY_CENTER);
- gl_view_set_default_text_alignment (property_bar->view,
+ gl_view_set_default_text_alignment (property_bar->priv->view,
GTK_JUSTIFY_CENTER);
-
- /* Adjust state of siblings */
- gl_ui_util_set_verb_state (ui_component,
- "/commands/PropTextAlignLeft",
- FALSE);
- gl_ui_util_set_verb_state (ui_component,
- "/commands/PropTextAlignRight",
- FALSE);
}
- if (s && (strcmp (path, "PropTextAlignRight") == 0))
- {
- gl_view_set_selection_text_alignment (property_bar->view,
+ if (gtk_toggle_tool_button_get_active (GTK_TOGGLE_TOOL_BUTTON (property_bar->priv->text_align_right_radio)))
+ {
+ gl_view_set_selection_text_alignment (property_bar->priv->view,
GTK_JUSTIFY_RIGHT);
- gl_view_set_default_text_alignment (property_bar->view,
+ gl_view_set_default_text_alignment (property_bar->priv->view,
GTK_JUSTIFY_RIGHT);
-
- /* Adjust state of siblings */
- gl_ui_util_set_verb_state (ui_component,
- "/commands/PropTextAlignLeft",
- FALSE);
- gl_ui_util_set_verb_state (ui_component,
- "/commands/PropTextAlignCenter",
- FALSE);
}
- g_signal_handlers_unblock_by_func (G_OBJECT(property_bar->view->label),
+ g_signal_handlers_unblock_by_func (G_OBJECT(property_bar->priv->view->label),
selection_changed_cb,
property_bar);
+ gl_debug (DEBUG_PROPERTY_BAR, "END");
+}
+
+
+/*****************************************************************************/
+/* Construct color combo "Custom widget". */
+/*****************************************************************************/
+GtkWidget *
+gl_ui_property_bar_construct_color_combo (gchar *name,
+ gchar *string1,
+ gchar *string2,
+ gint int1,
+ gint int2)
+{
+ GtkWidget *color_combo;
+ ColorGroup *cg;
+ gchar *cg_name;
+ guint color;
+ GdkColor *gdk_color;
+ gchar *no_color;
+ GdkPixbuf *pixbuf = NULL;
+
+ switch (int1) {
+
+ case 0:
+ cg_name = "text_color_group";
+ color = gl_prefs->default_text_color;
+ no_color = _("Default");
+ pixbuf = gdk_pixbuf_new_from_inline (-1, stock_text_24, FALSE, NULL);
+ break;
+
+ case 2:
+ cg_name = "line_color_group";
+ color = gl_prefs->default_line_color;
+ no_color = _("No line");
+ pixbuf = gdk_pixbuf_new_from_inline (-1, stock_pencil_24, FALSE, NULL);
+ break;
+
+ case 1:
+ default:
+ cg_name = "fill_color_group";
+ color = gl_prefs->default_fill_color;
+ no_color = _("No fill");
+ pixbuf = gdk_pixbuf_new_from_inline (-1, stock_bucket_fill_24, FALSE, NULL);
+ break;
+
+ }
+
+ cg = color_group_fetch (cg_name, NULL);
+ gdk_color = gl_color_to_gdk_color (color);
+ color_combo = color_combo_new (pixbuf, no_color, gdk_color, cg);
+ g_free (gdk_color);
+
+ color_combo_box_set_preview_relief (COLOR_COMBO(color_combo), GTK_RELIEF_NORMAL);
+
+ return color_combo;
+}
+
+/*---------------------------------------------------------------------------*/
+/* PRIVATE. Set sensitivity of doc controls. */
+/*---------------------------------------------------------------------------*/
+static void
+set_doc_items_sensitive (glUIPropertyBar *property_bar,
+ gboolean state)
+{
+ gtk_widget_set_sensitive (property_bar->priv->font_family_combo, state);
+ gtk_widget_set_sensitive (property_bar->priv->font_size_spin, state);
+ gtk_widget_set_sensitive (property_bar->priv->font_bold_toggle, state);
+ gtk_widget_set_sensitive (property_bar->priv->font_italic_toggle, state);
+ gtk_widget_set_sensitive (property_bar->priv->text_align_left_radio, state);
+ gtk_widget_set_sensitive (property_bar->priv->text_align_center_radio, state);
+ gtk_widget_set_sensitive (property_bar->priv->text_align_right_radio, state);
+ gtk_widget_set_sensitive (property_bar->priv->text_color_combo, state);
+ gtk_widget_set_sensitive (property_bar->priv->fill_color_combo, state);
+ gtk_widget_set_sensitive (property_bar->priv->line_color_combo, state);
+ gtk_widget_set_sensitive (property_bar->priv->line_width_spin, state);
}
-/*---------------------------------------------------------------------------------------*/
-/* NULL command handler -- hides bogus "verb not found" errors for toggle toolbar items. */
-/*---------------------------------------------------------------------------------------*/
+/*---------------------------------------------------------------------------*/
+/* PRIVATE. Set sensitivity of text related controls. */
+/*---------------------------------------------------------------------------*/
static void
-null_cmd (BonoboUIComponent *ui_component,
- gpointer user_data,
- const gchar *verbname)
+set_text_items_sensitive (glUIPropertyBar *property_bar,
+ gboolean state)
{
+ gtk_widget_set_sensitive (property_bar->priv->font_family_combo, state);
+ gtk_widget_set_sensitive (property_bar->priv->font_size_spin, state);
+ gtk_widget_set_sensitive (property_bar->priv->font_bold_toggle, state);
+ gtk_widget_set_sensitive (property_bar->priv->font_italic_toggle, state);
+ gtk_widget_set_sensitive (property_bar->priv->text_align_left_radio, state);
+ gtk_widget_set_sensitive (property_bar->priv->text_align_center_radio, state);
+ gtk_widget_set_sensitive (property_bar->priv->text_align_right_radio, state);
+ gtk_widget_set_sensitive (property_bar->priv->text_color_combo, state);
}
+
+/*---------------------------------------------------------------------------*/
+/* PRIVATE. Set sensitivity of fill related controls. */
+/*---------------------------------------------------------------------------*/
+static void
+set_fill_items_sensitive (glUIPropertyBar *property_bar,
+ gboolean state)
+{
+ gtk_widget_set_sensitive (property_bar->priv->fill_color_combo, state);
+}
+
+/*---------------------------------------------------------------------------*/
+/* PRIVATE. Set sensitivity of line color related controls. */
+/*---------------------------------------------------------------------------*/
+static void
+set_line_color_items_sensitive (glUIPropertyBar *property_bar,
+ gboolean state)
+{
+ gtk_widget_set_sensitive (property_bar->priv->line_color_combo, state);
+}
+
+/*---------------------------------------------------------------------------*/
+/* PRIVATE. Set sensitivity of line width related controls. */
+/*---------------------------------------------------------------------------*/
+static void
+set_line_width_items_sensitive (glUIPropertyBar *property_bar,
+ gboolean state)
+{
+ gtk_widget_set_sensitive (property_bar->priv->line_width_spin, state);
+}
+
+
-/*
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/**
* (GLABELS) Label and Business Card Creation program for GNOME
*
* ui-property-bar.h: Property toolbar header file
#ifndef __UI_PROPERTY_BAR_H__
#define __UI_PROPERTY_BAR_H__
-#include <glib-object.h>
-#include <bonobo/bonobo-ui-component.h>
-#include <bonobo/bonobo-window.h>
+#include <gtk/gtkhbox.h>
#include "view.h"
#define GL_IS_UI_PROPERTY_BAR_CLASS(klass) \
(GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_UI_PROPERTY_BAR))
-typedef struct _glUIPropertyBar glUIPropertyBar;
-typedef struct _glUIPropertyBarClass glUIPropertyBarClass;
-
-struct _glUIPropertyBar {
- GObject parent_widget;
-
- BonoboUIComponent *ui_component;
+typedef struct _glUIPropertyBar glUIPropertyBar;
+typedef struct _glUIPropertyBarClass glUIPropertyBarClass;
- glView *view;
+typedef struct _glUIPropertyBarPrivate glUIPropertyBarPrivate;
- GtkWidget *font_family_combo;
- GtkWidget *font_size_spin;
- GtkWidget *text_color_combo;
-
- GtkWidget *fill_color_combo;
+struct _glUIPropertyBar {
+ GtkHBox parent_widget;
- GtkWidget *line_color_combo;
- GtkWidget *line_width_spin;
+ glUIPropertyBarPrivate *priv;
- gboolean stop_signals;
};
struct _glUIPropertyBarClass {
- GObjectClass parent_class;
+ GtkHBoxClass parent_class;
};
GType gl_ui_property_bar_get_type (void) G_GNUC_CONST;
-GObject *gl_ui_property_bar_new (BonoboUIComponent *ui_component);
+GtkWidget *gl_ui_property_bar_new (void);
void gl_ui_property_bar_set_view (glUIPropertyBar *property_bar,
glView *view);
+void gl_ui_property_bar_set_tooltips (glUIPropertyBar *property_bar,
+ gboolean state);
+
+
G_END_DECLS
-/*
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/**
* (GLABELS) Label and Business Card Creation program for GNOME
*
* ui-sidebar.c: Object property sidebar
#define DEFAULT_SIDEBAR_WIDTH 340
/*============================================================================*/
-/* Private globals */
+/* Private data types */
/*============================================================================*/
-static GObjectClass *parent_class;
+struct _glUISidebarPrivate {
-static gchar* doc_verbs [] = {
- "/commands/PropertyEditor",
+ glView *view;
- NULL
+ GtkWidget *child;
+ GtkWidget *empty_child;
};
+/*============================================================================*/
+/* Private globals */
+/*============================================================================*/
+
+static GtkVBoxClass *parent_class;
+
/*============================================================================*/
/* Local function prototypes */
/*============================================================================*/
static void gl_ui_sidebar_instance_init (glUISidebar *sidebar);
static void gl_ui_sidebar_finalize (GObject *object);
-static void gl_ui_sidebar_construct (glUISidebar *sidebar,
- BonoboUIComponent *ui_component);
+static void gl_ui_sidebar_construct (glUISidebar *sidebar);
static void selection_changed_cb (glView *view,
glUISidebar *sidebar);
{
gl_debug (DEBUG_UI, "START");
- sidebar->view = NULL;
+ sidebar->priv = g_new0 (glUISidebarPrivate, 1);
gl_debug (DEBUG_UI, "END");
}
sidebar = GL_UI_SIDEBAR (object);
- if (sidebar->view) {
- g_object_unref (G_OBJECT(sidebar->view));
- sidebar = NULL;
+ if (sidebar->priv->view) {
+ g_object_unref (G_OBJECT(sidebar->priv->view));
}
G_OBJECT_CLASS (parent_class)->finalize (object);
+ g_free (sidebar->priv);
+
gl_debug (DEBUG_UI, "END");
}
/****************************************************************************/
/* Create a NEW sidebar. */
/****************************************************************************/
-GObject *
-gl_ui_sidebar_new (BonoboUIComponent *ui_component)
+GtkWidget *
+gl_ui_sidebar_new (void)
{
glUISidebar *sidebar;
gtk_widget_set_size_request (GTK_WIDGET (sidebar), DEFAULT_SIDEBAR_WIDTH, -1);
- gl_ui_sidebar_construct (sidebar, ui_component);
+ gl_ui_sidebar_construct (sidebar);
gl_debug (DEBUG_UI, "END");
- return G_OBJECT(sidebar);
+ return GTK_WIDGET(sidebar);
}
/******************************************************************************/
/* Initialize property toolbar. */
/******************************************************************************/
static void
-gl_ui_sidebar_construct (glUISidebar *sidebar,
- BonoboUIComponent *ui_component)
+gl_ui_sidebar_construct (glUISidebar *sidebar)
{
gl_debug (DEBUG_UI, "START");
- sidebar->ui_component = ui_component;
-
- gl_ui_util_insert_widget (ui_component,
- GTK_WIDGET (sidebar),
- "/PropertySidebar/PropertyEditor");
+ sidebar->priv->empty_child = gl_object_editor_new (GL_STOCK_PROPERTIES,
+ _("Object properties"),
+ GL_OBJECT_EDITOR_EMPTY,
+ NULL);
- sidebar->empty_child = gl_object_editor_new (GL_STOCK_PROPERTIES,
- _("Object properties"),
- GL_OBJECT_EDITOR_EMPTY,
- NULL);
+ sidebar->priv->child = gtk_widget_ref (sidebar->priv->empty_child);
+ gtk_widget_show (sidebar->priv->child);
+ gtk_container_add (GTK_CONTAINER(sidebar), sidebar->priv->child);
- sidebar->child = gtk_widget_ref (sidebar->empty_child);
- gtk_widget_show (sidebar->child);
- gtk_container_add (GTK_CONTAINER(sidebar), sidebar->child);
-
- gl_ui_util_set_verb_list_sensitive (ui_component, doc_verbs, FALSE);
+ gtk_widget_set_sensitive (GTK_WIDGET (sidebar), FALSE);
gl_debug (DEBUG_UI, "END");
}
g_return_if_fail (view && GL_IS_VIEW (view));
- gl_ui_util_set_verb_list_sensitive (sidebar->ui_component, doc_verbs, TRUE);
+ gtk_widget_set_sensitive (GTK_WIDGET (sidebar), TRUE);
- sidebar->view = GL_VIEW (g_object_ref (G_OBJECT (view)));
+ sidebar->priv->view = GL_VIEW (g_object_ref (G_OBJECT (view)));
g_signal_connect (G_OBJECT(view), "selection_changed",
G_CALLBACK(selection_changed_cb), sidebar);
g_return_if_fail (view && GL_IS_VIEW (view));
g_return_if_fail (sidebar && GL_IS_UI_SIDEBAR (sidebar));
- gtk_container_remove (GTK_CONTAINER(sidebar), sidebar->child);
+ gtk_container_remove (GTK_CONTAINER(sidebar), sidebar->priv->child);
if (gl_view_is_selection_empty (view) || !gl_view_is_selection_atomic (view)) {
- sidebar->child = gtk_widget_ref (sidebar->empty_child);
+ sidebar->priv->child = gtk_widget_ref (sidebar->priv->empty_child);
} else {
- sidebar->child = gtk_widget_ref (gl_view_get_editor (view));
+ sidebar->priv->child = gtk_widget_ref (gl_view_get_editor (view));
}
- gtk_widget_show (sidebar->child);
-#if 0
- gtk_container_add (GTK_CONTAINER(sidebar), sidebar->child);
-#else
- gtk_box_pack_start (GTK_BOX(sidebar), sidebar->child, TRUE, TRUE, 0);
-#endif
+ gtk_widget_show (sidebar->priv->child);
+
+ gtk_box_pack_start (GTK_BOX(sidebar), sidebar->priv->child, TRUE, TRUE, 0);
gl_debug (DEBUG_UI, "END");
}
-/*
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/**
* (GLABELS) Label and Business Card Creation program for GNOME
*
* ui-sidebar.h: Object property sidebar header file
#ifndef __UI_SIDEBAR_H__
#define __UI_SIDEBAR_H__
-#include <glib-object.h>
-#include <bonobo/bonobo-ui-component.h>
-#include <bonobo/bonobo-window.h>
+#include <gtk/gtkvbox.h>
#include "view.h"
#define GL_IS_UI_SIDEBAR_CLASS(klass) \
(GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_UI_SIDEBAR))
-typedef struct _glUISidebar glUISidebar;
-typedef struct _glUISidebarClass glUISidebarClass;
+typedef struct _glUISidebar glUISidebar;
+typedef struct _glUISidebarClass glUISidebarClass;
+
+typedef struct _glUISidebarPrivate glUISidebarPrivate;
struct _glUISidebar {
GtkVBox parent_widget;
- BonoboUIComponent *ui_component;
-
- glView *view;
- GtkWidget *child;
- GtkWidget *empty_child;
+ glUISidebarPrivate *priv;
};
struct _glUISidebarClass {
GType gl_ui_sidebar_get_type (void) G_GNUC_CONST;
-GObject *gl_ui_sidebar_new (BonoboUIComponent *ui_component);
+GtkWidget *gl_ui_sidebar_new (void);
void gl_ui_sidebar_set_view (glUISidebar *sidebar,
glView *view);
-/*
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/**
* (GLABELS) Label and Business Card Creation program for GNOME
*
* ui-util.c: GLabels ui utilities module
#include "ui-util.h"
-#include <bonobo/bonobo-control.h>
+#include <gtk/gtkaction.h>
+#include <gtk/gtktoggleaction.h>
#include "debug.h"
/* Set sensitivity of verb. */
/*****************************************************************************/
void
-gl_ui_util_set_verb_sensitive (BonoboUIComponent *ui_component,
- gchar *cname,
- gboolean sensitive)
+gl_ui_util_set_verb_sensitive (GtkUIManager *ui,
+ gchar *cname,
+ gboolean sensitive)
{
+ GtkAction *action;
+
gl_debug (DEBUG_UI, "START");
g_return_if_fail (cname != NULL);
- g_return_if_fail (BONOBO_IS_UI_COMPONENT (ui_component));
+ g_return_if_fail (GTK_IS_UI_MANAGER (ui));
- bonobo_ui_component_set_prop (ui_component,
- cname,
- "sensitive",
- sensitive ? "1" : "0",
- NULL);
+ action = gtk_ui_manager_get_action (ui, cname);
+
+ if (action) {
+ gl_debug (DEBUG_UI, "Set action \"%s\" sensitive = %d", cname, sensitive);
+ gtk_action_set_sensitive (action, sensitive);
+ }
gl_debug (DEBUG_UI, "END");
}
/* Set sensitivity of a list of verbs. */
/*****************************************************************************/
void
-gl_ui_util_set_verb_list_sensitive (BonoboUIComponent *ui_component,
- gchar **vlist,
- gboolean sensitive)
+gl_ui_util_set_verb_list_sensitive (GtkUIManager *ui,
+ gchar **vlist,
+ gboolean sensitive)
{
+ GtkAction *action;
+
gl_debug (DEBUG_UI, "START");
g_return_if_fail (vlist != NULL);
- g_return_if_fail (BONOBO_IS_UI_COMPONENT (ui_component));
+ g_return_if_fail (GTK_IS_UI_MANAGER (ui));
for ( ; *vlist; ++vlist)
{
- bonobo_ui_component_set_prop (ui_component,
- *vlist,
- "sensitive",
- sensitive ? "1" : "0",
- NULL);
+ action = gtk_ui_manager_get_action (ui, *vlist);
+
+ if (action) {
+ gtk_action_set_sensitive (action, sensitive);
+ }
}
gl_debug (DEBUG_UI, "END");
/* Set state of a verb. */
/*****************************************************************************/
void
-gl_ui_util_set_verb_state (BonoboUIComponent *ui_component,
- gchar *cname,
- gboolean state)
+gl_ui_util_set_verb_state (GtkUIManager *ui,
+ gchar *cname,
+ gboolean state)
{
+ GtkToggleAction *action;
+
gl_debug (DEBUG_UI, "START");
g_return_if_fail (cname != NULL);
- g_return_if_fail (BONOBO_IS_UI_COMPONENT (ui_component));
-
- bonobo_ui_component_set_prop (ui_component,
- cname,
- "state",
- state ? "1" : "0",
- NULL);
-
- gl_debug (DEBUG_UI, "END");
-}
+ g_return_if_fail (GTK_IS_UI_MANAGER (ui));
-\f
-/*****************************************************************************/
-/* Insert widget at path. */
-/*****************************************************************************/
-void
-gl_ui_util_insert_widget (BonoboUIComponent *ui_component,
- GtkWidget *widget,
- const char *path)
-{
- BonoboControl *control;
-
- gl_debug (DEBUG_UI, "START");
+ action = GTK_TOGGLE_ACTION (gtk_ui_manager_get_action (ui, cname));
- gtk_widget_show_all (widget);
- control = bonobo_control_new (widget);
- bonobo_ui_component_object_set (ui_component,
- path,
- BONOBO_OBJREF (control),
- NULL);
- bonobo_object_unref (BONOBO_OBJECT (control));
+ if (action) {
+ gtk_toggle_action_set_active (action, state);
+ }
gl_debug (DEBUG_UI, "END");
}
-/*
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/**
* (GLABELS) Label and Business Card Creation program for GNOME
*
* ui-util.h: GLabels UI utilities module header file
#ifndef __GL_UI_UTIL_H__
#define __GL_UI_UTIL_H__
-#include <bonobo/bonobo-ui-component.h>
+#include <gtk/gtkuimanager.h>
G_BEGIN_DECLS
-void gl_ui_util_set_verb_sensitive (BonoboUIComponent *ui_component,
- gchar *cname,
- gboolean sensitive);
-
-void gl_ui_util_set_verb_list_sensitive (BonoboUIComponent *ui_component,
- gchar **vlist,
- gboolean sensitive);
-
-void gl_ui_util_set_verb_state (BonoboUIComponent *ui_component,
- gchar *cname,
- gboolean state);
+void gl_ui_util_set_verb_sensitive (GtkUIManager *ui,
+ gchar *cname,
+ gboolean sensitive);
-void gl_ui_util_insert_widget (BonoboUIComponent *ui_component,
- GtkWidget *widget,
- const char *path);
+void gl_ui_util_set_verb_list_sensitive (GtkUIManager *ui,
+ gchar **vlist,
+ gboolean sensitive);
+void gl_ui_util_set_verb_state (GtkUIManager *ui,
+ gchar *cname,
+ gboolean state);
G_END_DECLS
-/*
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/**
* (GLABELS) Label and Business Card Creation program for GNOME
*
* ui.c: GLabels ui module
#include "ui.h"
-#include "recent-files/egg-recent-view.h"
-#include "recent-files/egg-recent-view-bonobo.h"
+#include <glib/gi18n.h>
#include <gconf/gconf-client.h>
#include "ui-util.h"
-#include "commands.h"
-#include "tools.h"
-#include "recent.h"
+#include "ui-commands.h"
#include "file.h"
#include "prefs.h"
+#include "stock.h"
+#include "window.h"
#include "debug.h"
/*==========================================================================*/
/* Private macros and constants. */
/*==========================================================================*/
-#define GLABELS_UI_XML GLABELS_UI_DIR "glabels-ui.xml"
/*==========================================================================*/
/* Private types. */
/*==========================================================================*/
+/*==========================================================================*/
+/* Local function prototypes */
+/*==========================================================================*/
+
+static void view_ui_item_toggled_cb (GtkToggleAction *action,
+ GtkUIManager *ui);
+
+static void set_app_main_toolbar_style (GtkUIManager *ui);
+
+static void set_app_drawing_toolbar_style (GtkUIManager *ui);
+
+static void set_view_style (GtkUIManager *ui);
+
/*==========================================================================*/
/* Private globals */
/*==========================================================================*/
-static BonoboUIVerb gl_ui_verbs [] = {
- BONOBO_UI_VERB ("FileNew", gl_cmd_file_new),
- BONOBO_UI_VERB ("FileProperties", gl_cmd_file_properties),
- BONOBO_UI_VERB ("FileTemplateDesigner", gl_cmd_file_template_designer),
- BONOBO_UI_VERB ("FileOpen", gl_cmd_file_open),
- BONOBO_UI_VERB ("FileSave", gl_cmd_file_save),
- BONOBO_UI_VERB ("FileSaveAs", gl_cmd_file_save_as),
- BONOBO_UI_VERB ("FilePrint", gl_cmd_file_print),
- BONOBO_UI_VERB ("FileClose", gl_cmd_file_close),
- BONOBO_UI_VERB ("FileExit", gl_cmd_file_exit),
- BONOBO_UI_VERB ("EditCut", gl_cmd_edit_cut),
- BONOBO_UI_VERB ("EditCopy", gl_cmd_edit_copy),
- BONOBO_UI_VERB ("EditPaste", gl_cmd_edit_paste),
- BONOBO_UI_VERB ("EditDelete", gl_cmd_edit_delete),
- BONOBO_UI_VERB ("EditSelectAll", gl_cmd_edit_select_all),
- BONOBO_UI_VERB ("EditUnSelectAll", gl_cmd_edit_unselect_all),
- BONOBO_UI_VERB ("ToolsArrow", gl_tools_arrow),
- BONOBO_UI_VERB ("ToolsText", gl_tools_text),
- BONOBO_UI_VERB ("ToolsBox", gl_tools_box),
- BONOBO_UI_VERB ("ToolsLine", gl_tools_line),
- BONOBO_UI_VERB ("ToolsEllipse", gl_tools_ellipse),
- BONOBO_UI_VERB ("ToolsImage", gl_tools_image),
- BONOBO_UI_VERB ("ToolsBarcode", gl_tools_barcode),
- BONOBO_UI_VERB ("ToolsZoomIn", gl_tools_zoomin),
- BONOBO_UI_VERB ("ToolsZoomOut", gl_tools_zoomout),
- BONOBO_UI_VERB ("ToolsZoom1to1", gl_tools_zoom1to1),
- BONOBO_UI_VERB ("ToolsZoomToFit", gl_tools_zoom_to_fit),
- BONOBO_UI_VERB ("ToolsMergeProperties", gl_tools_merge_properties),
- BONOBO_UI_VERB ("ToolsRaiseObjects", gl_tools_raise_objects),
- BONOBO_UI_VERB ("ToolsLowerObjects", gl_tools_lower_objects),
- BONOBO_UI_VERB ("ToolsRotateLeft", gl_tools_rotate_objects_left),
- BONOBO_UI_VERB ("ToolsRotateRight", gl_tools_rotate_objects_right),
- BONOBO_UI_VERB ("ToolsFlipHorizontal", gl_tools_flip_objects_horiz),
- BONOBO_UI_VERB ("ToolsFlipVertical", gl_tools_flip_objects_vert),
- BONOBO_UI_VERB ("ToolsAlignLeft", gl_tools_align_objects_left),
- BONOBO_UI_VERB ("ToolsAlignRight", gl_tools_align_objects_right),
- BONOBO_UI_VERB ("ToolsAlignHCenter", gl_tools_align_objects_hcenter),
- BONOBO_UI_VERB ("ToolsAlignTop", gl_tools_align_objects_top),
- BONOBO_UI_VERB ("ToolsAlignBottom", gl_tools_align_objects_bottom),
- BONOBO_UI_VERB ("ToolsAlignVCenter", gl_tools_align_objects_vcenter),
- BONOBO_UI_VERB ("ToolsCenterHorizontal", gl_tools_center_objects_horiz),
- BONOBO_UI_VERB ("ToolsCenterVertical", gl_tools_center_objects_vert),
- BONOBO_UI_VERB ("SettingsPreferences", gl_cmd_settings_preferences),
- BONOBO_UI_VERB ("HelpContents", gl_cmd_help_contents),
- BONOBO_UI_VERB ("About", gl_cmd_help_about),
-
- BONOBO_UI_VERB_END
+static GtkActionEntry entries[] = {
+
+ /* Menu entries. */
+ { "FileMenu", NULL, "_File" },
+ { "FileRecentsMenu", NULL, "Recent _Files" },
+ { "EditMenu", NULL, "_Edit" },
+ { "ViewMenu", NULL, "_View" },
+ { "ViewMainToolBarMenu", NULL, "Customize Main Toolbar" },
+ { "ViewDrawingToolBarMenu", NULL, "Customize Drawing Toolbar" },
+ { "ViewPropertyToolBarMenu", NULL, "Customize Properties Toolbar" },
+ { "ObjectsMenu", NULL, "_Objects" },
+ { "ObjectsCreateMenu", NULL, "_Create" },
+ { "ObjectsOrderMenu", NULL, "_Order" },
+ { "ObjectsRotateFlipMenu", NULL, "_Rotate/Flip" },
+ { "ObjectsAlignHorizMenu", NULL, "Align _Horizontal" },
+ { "ObjectsAlignVertMenu", NULL, "Align _Vertical" },
+ { "HelpMenu", NULL, "_Help" },
+
+
+ /* File action entries. */
+ { "FileNew",
+ GTK_STOCK_NEW,
+ "_New",
+ "<control>N",
+ "Create a new file",
+ G_CALLBACK (gl_ui_cmd_file_new) },
+
+ { "FileOpen",
+ GTK_STOCK_OPEN,
+ "_Open...",
+ "<control>O",
+ "Open a file",
+ G_CALLBACK (gl_ui_cmd_file_open) },
+
+ { "FileSave",
+ GTK_STOCK_SAVE,
+ "_Save",
+ "<control>S",
+ "Save current file",
+ G_CALLBACK (gl_ui_cmd_file_save) },
+
+ { "FileSaveAs",
+ GTK_STOCK_SAVE,
+ "Save _As...",
+ "<shift><control>S",
+ "Save the current file to a different name",
+ G_CALLBACK (gl_ui_cmd_file_save_as) },
+
+ { "FilePrint",
+ GTK_STOCK_PRINT,
+ "_Print...",
+ "<control>P",
+ "Print the current file",
+ G_CALLBACK (gl_ui_cmd_file_print) },
+
+ { "FileProperties",
+ GTK_STOCK_PROPERTIES,
+ "Properties...",
+ NULL,
+ "Modify document properties",
+ G_CALLBACK (gl_ui_cmd_file_properties) },
+
+ { "FileTemplateDesigner",
+ NULL,
+ "Template _Designer...",
+ NULL,
+ "Create a custom template",
+ G_CALLBACK (gl_ui_cmd_file_template_designer) },
+
+ { "FileClose",
+ GTK_STOCK_CLOSE,
+ "_Close",
+ "<alt>F4",
+ "Close the current file",
+ G_CALLBACK (gl_ui_cmd_file_close) },
+
+ { "FileQuit",
+ GTK_STOCK_QUIT,
+ "_Quit",
+ "<control>Q",
+ "Quit the program",
+ G_CALLBACK (gl_ui_cmd_file_quit) },
+
+
+ /* Edit action entries. */
+ { "EditCut",
+ GTK_STOCK_CUT,
+ "Cut",
+ "<control>X",
+ "Cut the selection",
+ G_CALLBACK (gl_ui_cmd_edit_cut) },
+
+ { "EditCopy",
+ GTK_STOCK_COPY,
+ "Copy",
+ "<control>C",
+ "Copy the selection",
+ G_CALLBACK (gl_ui_cmd_edit_copy) },
+
+ { "EditPaste",
+ GTK_STOCK_PASTE,
+ "Paste",
+ "<control>V",
+ "Paste the clipboard",
+ G_CALLBACK (gl_ui_cmd_edit_paste) },
+
+ { "EditDelete",
+ NULL,
+ "Delete",
+ NULL,
+ "Delete the selected objects",
+ G_CALLBACK (gl_ui_cmd_edit_delete) },
+
+ { "EditSelectAll",
+ NULL,
+ "Select All",
+ "<control>A",
+ "Select all objects",
+ G_CALLBACK (gl_ui_cmd_edit_select_all) },
+
+ { "EditUnSelectAll",
+ NULL,
+ "Un-select All",
+ NULL,
+ "Remove all selections",
+ G_CALLBACK (gl_ui_cmd_edit_unselect_all) },
+
+ { "EditPreferences",
+ GTK_STOCK_PREFERENCES,
+ "Preferences",
+ NULL,
+ "Configure the application",
+ G_CALLBACK (gl_ui_cmd_edit_preferences) },
+
+
+ /* View action entries. */
+ { "ViewZoomIn",
+ GTK_STOCK_ZOOM_IN,
+ "Zoom in",
+ NULL,
+ "Increase magnification",
+ G_CALLBACK (gl_ui_cmd_view_zoomin) },
+
+ { "ViewZoomOut",
+ GTK_STOCK_ZOOM_OUT,
+ "Zoom out",
+ NULL,
+ "Decrease magnification",
+ G_CALLBACK (gl_ui_cmd_view_zoomout) },
+
+ { "ViewZoom1to1",
+ GTK_STOCK_ZOOM_100,
+ "Zoom 1 to 1",
+ NULL,
+ "Restore scale to 100%",
+ G_CALLBACK (gl_ui_cmd_view_zoom1to1) },
+
+ { "ViewZoomToFit",
+ GTK_STOCK_ZOOM_FIT,
+ "Zoom to fit",
+ NULL,
+ "Set scale to fit window",
+ G_CALLBACK (gl_ui_cmd_view_zoom_to_fit) },
+
+
+ /* Objects action entries. */
+ { "ObjectsArrowMode",
+ GL_STOCK_ARROW,
+ "Select Mode",
+ NULL,
+ "Select, move and modify objects",
+ G_CALLBACK (gl_ui_cmd_objects_arrow_mode) },
+
+ { "ObjectsCreateText",
+ GL_STOCK_TEXT,
+ "Text",
+ NULL,
+ "Create text object",
+ G_CALLBACK (gl_ui_cmd_objects_create_text) },
+
+ { "ObjectsCreateBox",
+ GL_STOCK_BOX,
+ "Box",
+ NULL,
+ "Create box/rectangle object",
+ G_CALLBACK (gl_ui_cmd_objects_create_box) },
+
+ { "ObjectsCreateLine",
+ GL_STOCK_LINE,
+ "Line",
+ NULL,
+ "Create line object",
+ G_CALLBACK (gl_ui_cmd_objects_create_line) },
+
+ { "ObjectsCreateEllipse",
+ GL_STOCK_ELLIPSE,
+ "Ellipse",
+ NULL,
+ "Create ellipse/circle object",
+ G_CALLBACK (gl_ui_cmd_objects_create_ellipse) },
+
+ { "ObjectsCreateImage",
+ GL_STOCK_IMAGE,
+ "Image",
+ NULL,
+ "Create image object",
+ G_CALLBACK (gl_ui_cmd_objects_create_image) },
+
+ { "ObjectsCreateBarcode",
+ GL_STOCK_BARCODE,
+ "Barcode",
+ NULL,
+ "Create barcode object",
+ G_CALLBACK (gl_ui_cmd_objects_create_barcode) },
+
+ { "ObjectsRaise",
+ GL_STOCK_ORDER_TOP,
+ "Bring to front", NULL,
+ "Raise object to top",
+ G_CALLBACK (gl_ui_cmd_objects_raise) },
+
+ { "ObjectsLower",
+ GL_STOCK_ORDER_BOTTOM,
+ "Send to back",
+ NULL,
+ "Lower object to bottom",
+ G_CALLBACK (gl_ui_cmd_objects_lower) },
+
+ { "ObjectsRotateLeft",
+ GL_STOCK_ROTATE_LEFT,
+ "Rotate left",
+ NULL,
+ "Rotate object 90 degrees counter-clockwise",
+ G_CALLBACK (gl_ui_cmd_objects_rotate_left) },
+
+ { "ObjectsRotateRight",
+ GL_STOCK_ROTATE_RIGHT,
+ "Rotate right",
+ NULL,
+ "Rotate object 90 degrees clockwise",
+ G_CALLBACK (gl_ui_cmd_objects_rotate_right) },
+
+ { "ObjectsFlipHorizontal",
+ GL_STOCK_FLIP_HORIZ,
+ "Flip horizontally",
+ NULL,
+ "Flip object horizontally",
+ G_CALLBACK (gl_ui_cmd_objects_flip_horiz) },
+
+ { "ObjectsFlipVertical",
+ GL_STOCK_FLIP_VERT,
+ "Flip vertically",
+ NULL,
+ "Flip object vertically",
+ G_CALLBACK (gl_ui_cmd_objects_flip_vert) },
+
+ { "ObjectsAlignLeft",
+ GL_STOCK_ALIGN_LEFT,
+ "Align left",
+ NULL,
+ "Align objects to left edges",
+ G_CALLBACK (gl_ui_cmd_objects_align_left) },
+
+ { "ObjectsAlignRight",
+ GL_STOCK_ALIGN_RIGHT,
+ "Align right",
+ NULL,
+ "Align objects to right edges",
+ G_CALLBACK (gl_ui_cmd_objects_align_right) },
+
+ { "ObjectsAlignHCenter",
+ GL_STOCK_ALIGN_HCENTER,
+ "Align horizontal center",
+ NULL,
+ "Align objects to horizontal centers",
+ G_CALLBACK (gl_ui_cmd_objects_align_hcenter) },
+
+ { "ObjectsAlignTop",
+ GL_STOCK_ALIGN_TOP,
+ "Align tops",
+ NULL,
+ "Align objects to top edges",
+ G_CALLBACK (gl_ui_cmd_objects_align_top) },
+
+ { "ObjectsAlignBottom",
+ GL_STOCK_ALIGN_BOTTOM,
+ "Align bottoms",
+ NULL,
+ "Align objects to bottom edges",
+ G_CALLBACK (gl_ui_cmd_objects_align_bottom) },
+
+ { "ObjectsAlignVCenter",
+ GL_STOCK_ALIGN_VCENTER,
+ "Align vertical center",
+ NULL,
+ "Align objects to vertical centers",
+ G_CALLBACK (gl_ui_cmd_objects_align_vcenter) },
+
+ { "ObjectsCenterHorizontal",
+ GL_STOCK_CENTER_HORIZ,
+ "Center horizontally",
+ NULL,
+ "Center objects to horizontal label center",
+ G_CALLBACK (gl_ui_cmd_objects_center_horiz) },
+
+ { "ObjectsCenterVertical",
+ GL_STOCK_CENTER_VERT,
+ "Center vertically",
+ NULL,
+ "Center objects to vertical label center",
+ G_CALLBACK (gl_ui_cmd_objects_center_vert) },
+
+ { "ObjectsMergeProperties",
+ GL_STOCK_MERGE,
+ "Merge properties",
+ NULL,
+ "Edit merge properties",
+ G_CALLBACK (gl_ui_cmd_objects_merge_properties) },
+
+
+ /* Help actions entries. */
+ { "HelpContents",
+ GTK_STOCK_HELP,
+ "Contents",
+ "F1",
+ "Open glabels manual",
+ G_CALLBACK (gl_ui_cmd_help_contents) },
+
+ { "HelpAbout",
+ GTK_STOCK_ABOUT,
+ "About...",
+ NULL,
+ "About glabels",
+ G_CALLBACK (gl_ui_cmd_help_about) },
+
};
+static guint n_entries = G_N_ELEMENTS (entries);
+
+static GtkToggleActionEntry toggle_entries[] = {
+
+ { "ViewPropertyToolBar",
+ NULL,
+ "Property toolbar",
+ NULL,
+ "Change the visibility of the property toolbar in the current window",
+ G_CALLBACK (gl_ui_cmd_view_property_bar_toggle),
+ TRUE },
+
+ { "ViewPropertyToolBarToolTips",
+ NULL,
+ "Show tooltips",
+ NULL,
+ "Show tooltips for property toolbar",
+ G_CALLBACK (gl_ui_cmd_view_property_bar_tips_toggle),
+ TRUE },
+
+ { "ViewGrid",
+ NULL,
+ "Grid",
+ NULL,
+ "Change the visibility of the grid in the current window",
+ G_CALLBACK (gl_ui_cmd_view_grid_toggle),
+ TRUE },
+
+ { "ViewMarkup",
+ NULL,
+ "Markup",
+ NULL,
+ "Change the visibility of markup lines in the current window",
+ G_CALLBACK (gl_ui_cmd_view_markup_toggle),
+ TRUE },
+
+};
+static guint n_toggle_entries = G_N_ELEMENTS (toggle_entries);
+
+static GtkToggleActionEntry ui_toggle_entries[] = {
+
+ { "ViewMainToolBar",
+ NULL,
+ "Main toolbar",
+ NULL,
+ "Change the visibility of the main toolbar in the current window",
+ G_CALLBACK (view_ui_item_toggled_cb),
+ TRUE },
+
+ { "ViewDrawingToolBar",
+ NULL,
+ "Drawing toolbar",
+ NULL,
+ "Change the visibility of the drawing toolbar in the current window",
+ G_CALLBACK (view_ui_item_toggled_cb),
+ TRUE },
+
+ { "ViewMainToolBarToolTips",
+ NULL,
+ "Show tooltips",
+ NULL,
+ "Show tooltips for main toolbar",
+ G_CALLBACK (view_ui_item_toggled_cb),
+ TRUE },
+
+ { "ViewDrawingToolBarToolTips",
+ NULL,
+ "Show tooltips",
+ NULL,
+ "Show tooltips for drawing toolbar",
+ G_CALLBACK (view_ui_item_toggled_cb),
+ TRUE },
+
+};
+static guint n_ui_toggle_entries = G_N_ELEMENTS (ui_toggle_entries);
+
+static const gchar *ui_info =
+"<ui>"
+""
+" <menubar name='MenuBar'>"
+" <menu action='FileMenu'>"
+" <menuitem action='FileNew' />"
+" <menuitem action='FileOpen' />"
+" <menu action='FileRecentsMenu'>"
+" <placeholder name='FileRecentsPlaceHolder' />"
+" </menu>"
+" <separator />"
+" <menuitem action='FileSave' />"
+" <menuitem action='FileSaveAs' />"
+" <separator />"
+" <menuitem action='FilePrint' />"
+" <separator />"
+" <menuitem action='FileProperties' />"
+" <menuitem action='FileTemplateDesigner' />"
+" <separator />"
+" <menuitem action='FileClose' />"
+" <menuitem action='FileQuit' />"
+" </menu>"
+" <menu action='EditMenu'>"
+" <menuitem action='EditCut' />"
+" <menuitem action='EditCopy' />"
+" <menuitem action='EditPaste' />"
+" <menuitem action='EditDelete' />"
+" <separator />"
+" <menuitem action='EditSelectAll' />"
+" <menuitem action='EditUnSelectAll' />"
+" <separator />"
+" <menuitem action='EditPreferences' />"
+" </menu>"
+" <menu action='ViewMenu'>"
+" <menuitem action='ViewMainToolBar' />"
+" <menuitem action='ViewDrawingToolBar' />"
+" <menuitem action='ViewPropertyToolBar' />"
+" <separator />"
+" <menu action='ViewMainToolBarMenu'>"
+" <menuitem action='ViewMainToolBarToolTips' />"
+" </menu>"
+" <menu action='ViewDrawingToolBarMenu'>"
+" <menuitem action='ViewDrawingToolBarToolTips' />"
+" </menu>"
+" <menu action='ViewPropertyToolBarMenu'>"
+" <menuitem action='ViewPropertyToolBarToolTips' />"
+" </menu>"
+" <separator />"
+" <menuitem action='ViewGrid' />"
+" <menuitem action='ViewMarkup' />"
+" <separator />"
+" <menuitem action='ViewZoomIn' />"
+" <menuitem action='ViewZoomOut' />"
+" <menuitem action='ViewZoom1to1' />"
+" <menuitem action='ViewZoomToFit' />"
+" </menu>"
+" <menu action='ObjectsMenu'>"
+" <menuitem action='ObjectsArrowMode' />"
+" <menu action='ObjectsCreateMenu'>"
+" <menuitem action='ObjectsCreateText' />"
+" <menuitem action='ObjectsCreateBox' />"
+" <menuitem action='ObjectsCreateLine' />"
+" <menuitem action='ObjectsCreateEllipse' />"
+" <menuitem action='ObjectsCreateImage' />"
+" <menuitem action='ObjectsCreateBarcode' />"
+" </menu>"
+" <separator />"
+" <menu action='ObjectsOrderMenu'>"
+" <menuitem action='ObjectsRaise' />"
+" <menuitem action='ObjectsLower' />"
+" </menu>"
+" <menu action='ObjectsRotateFlipMenu'>"
+" <menuitem action='ObjectsRotateLeft' />"
+" <menuitem action='ObjectsRotateRight' />"
+" <menuitem action='ObjectsFlipHorizontal' />"
+" <menuitem action='ObjectsFlipVertical' />"
+" </menu>"
+" <menu action='ObjectsAlignHorizMenu'>"
+" <menuitem action='ObjectsAlignLeft' />"
+" <menuitem action='ObjectsAlignHCenter' />"
+" <menuitem action='ObjectsAlignRight' />"
+" <menuitem action='ObjectsCenterHorizontal' />"
+" </menu>"
+" <menu action='ObjectsAlignVertMenu'>"
+" <menuitem action='ObjectsAlignTop' />"
+" <menuitem action='ObjectsAlignVCenter' />"
+" <menuitem action='ObjectsAlignBottom' />"
+" <menuitem action='ObjectsCenterVertical' />"
+" </menu>"
+" <separator />"
+" <menuitem action='ObjectsMergeProperties' />"
+" </menu>"
+" <menu action='HelpMenu'>"
+" <menuitem action='HelpContents' />"
+" <menuitem action='HelpAbout' />"
+" </menu>"
+" </menubar>"
+""
+" <toolbar name='MainToolBar'>"
+" <toolitem action='FileNew' />"
+" <toolitem action='FileOpen' />"
+" <toolitem action='FileSave' />"
+" <separator />"
+" <toolitem action='FilePrint' />"
+" <separator />"
+" <toolitem action='EditCut' />"
+" <toolitem action='EditCopy' />"
+" <toolitem action='EditPaste' />"
+" </toolbar>"
+""
+" <toolbar name='DrawingToolBar'>"
+" <toolitem action='ObjectsArrowMode' />"
+" <separator />"
+" <toolitem action='ObjectsCreateText' />"
+" <toolitem action='ObjectsCreateBox' />"
+" <toolitem action='ObjectsCreateLine' />"
+" <toolitem action='ObjectsCreateEllipse' />"
+" <toolitem action='ObjectsCreateImage' />"
+" <toolitem action='ObjectsCreateBarcode' />"
+" <separator />"
+" <toolitem action='ViewZoomIn' />"
+" <toolitem action='ViewZoomOut' />"
+" <toolitem action='ViewZoom1to1' />"
+" <toolitem action='ViewZoomToFit' />"
+" <separator />"
+" <toolitem action='ObjectsMergeProperties' />"
+" </toolbar>"
+""
+"</ui>";
+
static gchar* doc_verbs [] = {
- "/commands/FileProperties",
- "/commands/FileSave",
- "/commands/FileSaveAs",
- "/commands/FilePrint",
- "/commands/FilePrintPreview",
- "/commands/FileClose",
- "/commands/FileCloseAll",
- "/commands/EditUndo",
- "/commands/EditRedo",
- "/commands/EditCut",
- "/commands/EditCopy",
- "/commands/EditPaste",
- "/commands/EditDelete",
- "/commands/EditSelectAll",
- "/commands/EditUnSelectAll",
- "/commands/ToolsArrow",
- "/commands/ToolsText",
- "/commands/ToolsLine",
- "/commands/ToolsBox",
- "/commands/ToolsEllipse",
- "/commands/ToolsImage",
- "/commands/ToolsBarcode",
- "/commands/ToolsZoomIn",
- "/commands/ToolsZoomOut",
- "/commands/ToolsZoom1to1",
- "/commands/ToolsZoomToFit",
- "/commands/ToolsMergeProperties",
- "/commands/ToolsRaiseObjects",
- "/commands/ToolsLowerObjects",
- "/commands/ToolsRotateLeft",
- "/commands/ToolsRotateRight",
- "/commands/ToolsFlipHorizontal",
- "/commands/ToolsFlipVertical",
- "/commands/ToolsAlignLeft",
- "/commands/ToolsAlignRight",
- "/commands/ToolsAlignHCenter",
- "/commands/ToolsAlignTop",
- "/commands/ToolsAlignBottom",
- "/commands/ToolsAlignVCenter",
- "/commands/ToolsCenterHorizontal",
- "/commands/ToolsCenterVertical",
- "/menu/Objects/CreateObjects",
- "/menu/Objects/Order",
- "/menu/Objects/RotateFlip",
- "/menu/Objects/AlignHoriz",
- "/menu/Objects/AlignVert",
- "/commands/ViewGrid",
- "/commands/ViewMarkup",
+ "/ui/MenuBar/FileMenu/FileProperties",
+ "/ui/MenuBar/FileMenu/FileSave",
+ "/ui/MenuBar/FileMenu/FileSaveAs",
+ "/ui/MenuBar/FileMenu/FilePrint",
+ "/ui/MenuBar/FileMenu/FileClose",
+ "/ui/MenuBar/EditMenu/EditCut",
+ "/ui/MenuBar/EditMenu/EditCopy",
+ "/ui/MenuBar/EditMenu/EditPaste",
+ "/ui/MenuBar/EditMenu/EditDelete",
+ "/ui/MenuBar/EditMenu/EditSelectAll",
+ "/ui/MenuBar/EditMenu/EditUnSelectAll",
+ "/ui/MenuBar/ViewMenu/ViewZoomIn",
+ "/ui/MenuBar/ViewMenu/ViewZoomOut",
+ "/ui/MenuBar/ViewMenu/ViewZoom1to1",
+ "/ui/MenuBar/ViewMenu/ViewZoomToFit",
+ "/ui/MenuBar/ViewMenu/ViewGrid",
+ "/ui/MenuBar/ViewMenu/ViewMarkup",
+ "/ui/MenuBar/ObjectsMenu/ObjectsArrowMode",
+ "/ui/MenuBar/ObjectsMenu/ObjectsCreateMenu/ObjectsCreateText",
+ "/ui/MenuBar/ObjectsMenu/ObjectsCreateMenu/ObjectsCreateLine",
+ "/ui/MenuBar/ObjectsMenu/ObjectsCreateMenu/ObjectsCreateBox",
+ "/ui/MenuBar/ObjectsMenu/ObjectsCreateMenu/ObjectsCreateEllipse",
+ "/ui/MenuBar/ObjectsMenu/ObjectsCreateMenu/ObjectsCreateImage",
+ "/ui/MenuBar/ObjectsMenu/ObjectsCreateMenu/ObjectsCreateBarcode",
+ "/ui/MenuBar/ObjectsMenu/ObjectsOrderMenu/ObjectsRaise",
+ "/ui/MenuBar/ObjectsMenu/ObjectsOrderMenu/ObjectsLower",
+ "/ui/MenuBar/ObjectsMenu/ObjectsRotateFlipMenu/ObjectsRotateLeft",
+ "/ui/MenuBar/ObjectsMenu/ObjectsRotateFlipMenu/ObjectsRotateRight",
+ "/ui/MenuBar/ObjectsMenu/ObjectsRotateFlipMenu/ObjectsFlipHorizontal",
+ "/ui/MenuBar/ObjectsMenu/ObjectsRotateFlipMenu/ObjectsFlipVertical",
+ "/ui/MenuBar/ObjectsMenu/ObjectsAlignHorizMenu/ObjectsAlignLeft",
+ "/ui/MenuBar/ObjectsMenu/ObjectsAlignHorizMenu/ObjectsAlignRight",
+ "/ui/MenuBar/ObjectsMenu/ObjectsAlignHorizMenu/ObjectsAlignHCenter",
+ "/ui/MenuBar/ObjectsMenu/ObjectsAlignHorizMenu/ObjectsCenterHorizontal",
+ "/ui/MenuBar/ObjectsMenu/ObjectsAlignVertMenu/ObjectsAlignTop",
+ "/ui/MenuBar/ObjectsMenu/ObjectsAlignVertMenu/ObjectsAlignBottom",
+ "/ui/MenuBar/ObjectsMenu/ObjectsAlignVertMenu/ObjectsAlignVCenter",
+ "/ui/MenuBar/ObjectsMenu/ObjectsAlignVertMenu/ObjectsCenterVertical",
+ "/ui/MenuBar/ObjectsMenu/ObjectsMergeProperties",
NULL
};
static gchar* doc_modified_verbs [] = {
- "/commands/FileSave",
+ "/ui/MenuBar/FileMenu/Save",
NULL
};
static gchar* selection_verbs [] = {
- "/commands/EditCut",
- "/commands/EditCopy",
- "/commands/EditDelete",
- "/commands/EditUnSelectAll",
- "/commands/ToolsRaiseObjects",
- "/commands/ToolsLowerObjects",
- "/commands/ToolsRotateLeft",
- "/commands/ToolsRotateRight",
- "/commands/ToolsFlipHorizontal",
- "/commands/ToolsFlipVertical",
- "/commands/ToolsCenterHorizontal",
- "/commands/ToolsCenterVertical",
- "/menu/Objects/Order",
- "/menu/Objects/RotateFlip",
- "/menu/Objects/AlignHoriz",
- "/menu/Objects/AlignVert",
+ "/ui/MenuBar/EditMenu/EditCut",
+ "/ui/MenuBar/EditMenu/EditCopy",
+ "/ui/MenuBar/EditMenu/EditDelete",
+ "/ui/MenuBar/EditMenu/EditUnSelectAll",
+ "/ui/MenuBar/ObjectsMenu/ObjectsOrderMenu/ObjectsRaise",
+ "/ui/MenuBar/ObjectsMenu/ObjectsOrderMenu/ObjectsLower",
+ "/ui/MenuBar/ObjectsMenu/ObjectsRotateFlipMenu/ObjectsRotateLeft",
+ "/ui/MenuBar/ObjectsMenu/ObjectsRotateFlipMenu/ObjectsRotateRight",
+ "/ui/MenuBar/ObjectsMenu/ObjectsRotateFlipMenu/ObjectsFlipHorizontal",
+ "/ui/MenuBar/ObjectsMenu/ObjectsRotateFlipMenu/ObjectsFlipVertical",
+ "/ui/MenuBar/ObjectsMenu/ObjectsAlignHorizMenu/ObjectsCenterHorizontal",
+ "/ui/MenuBar/ObjectsMenu/ObjectsAlignVertMenu/ObjectsCenterVertical",
NULL
};
};
static gchar* multi_selection_verbs [] = {
- "/commands/ToolsAlignLeft",
- "/commands/ToolsAlignRight",
- "/commands/ToolsAlignHCenter",
- "/commands/ToolsAlignTop",
- "/commands/ToolsAlignBottom",
- "/commands/ToolsAlignVCenter",
+ "/ui/MenuBar/ObjectsMenu/ObjectsAlignHorizMenu/ObjectsAlignLeft",
+ "/ui/MenuBar/ObjectsMenu/ObjectsAlignHorizMenu/ObjectsAlignRight",
+ "/ui/MenuBar/ObjectsMenu/ObjectsAlignHorizMenu/ObjectsAlignHCenter",
+ "/ui/MenuBar/ObjectsMenu/ObjectsAlignVertMenu/ObjectsAlignTop",
+ "/ui/MenuBar/ObjectsMenu/ObjectsAlignVertMenu/ObjectsAlignBottom",
+ "/ui/MenuBar/ObjectsMenu/ObjectsAlignVertMenu/ObjectsAlignVCenter",
NULL
};
-/*==========================================================================*/
-/* Local function prototypes */
-/*==========================================================================*/
-
-static void view_menu_item_toggled_cb (BonoboUIComponent *ui_component,
- const char *path,
- Bonobo_UIComponent_EventType type,
- const char *state,
- BonoboWindow *win);
-
-static void set_app_main_toolbar_style (BonoboUIComponent *ui_component);
-
-static void set_app_drawing_toolbar_style (BonoboUIComponent *ui_component);
-
-static void set_app_property_toolbar_style (BonoboUIComponent *ui_component);
-
-static void set_view_style (BonoboUIComponent *ui_component);
-
-
-\f
/*****************************************************************************/
/* Initialize UI component for given window. */
/*****************************************************************************/
-void
-gl_ui_init (BonoboUIComponent *ui_component,
- BonoboWindow *win,
- GtkWidget *cursor_info_frame,
- GtkWidget *zoom_info_frame)
+GtkUIManager *
+gl_ui_new (GtkWindow *window)
{
- EggRecentView *recent_view;
- EggRecentModel *recent_model;
- BonoboControl *control;
+ GtkUIManager *ui;
+ GtkActionGroup *actions;
+ GError *error = NULL;
gl_debug (DEBUG_UI, "START");
- gl_debug (DEBUG_UI, "window = %p", win);
+ g_return_val_if_fail (window && GTK_IS_WINDOW (window), NULL);
- g_return_if_fail (ui_component != NULL);
+ gl_debug (DEBUG_UI, "window = %p", window);
- bonobo_ui_engine_config_set_path (bonobo_window_get_ui_engine (win),
- "/glabels/UIConfig/kvps");
- gl_debug (DEBUG_UI, "Path set");
+ ui = gtk_ui_manager_new ();
- bonobo_ui_util_set_ui (ui_component,
- "", GLABELS_UI_XML, "gLabels", NULL);
- gl_debug (DEBUG_UI, "UI set");
+ actions = gtk_action_group_new ("Actions");
+ gtk_action_group_add_actions (actions, entries, n_entries, window);
+ gtk_action_group_add_toggle_actions (actions,
+ toggle_entries, n_toggle_entries,
+ window);
+ gtk_action_group_add_toggle_actions (actions,
+ ui_toggle_entries, n_ui_toggle_entries,
+ ui);
- bonobo_ui_component_add_verb_list_with_data(ui_component,
- gl_ui_verbs, win);
- gl_debug (DEBUG_UI, "verb list added");
-
- /* Set the toolbar style according to prefs */
- set_app_main_toolbar_style (ui_component);
-
- /* Add listener for the view menu */
- bonobo_ui_component_add_listener (ui_component, "ViewMainToolbar",
- (BonoboUIListenerFn)view_menu_item_toggled_cb,
- (gpointer)win);
-
- bonobo_ui_component_add_listener (ui_component, "MainToolbarSystem",
- (BonoboUIListenerFn)view_menu_item_toggled_cb,
- (gpointer)win);
- bonobo_ui_component_add_listener (ui_component, "MainToolbarIcon",
- (BonoboUIListenerFn)view_menu_item_toggled_cb,
- (gpointer)win);
- bonobo_ui_component_add_listener (ui_component, "MainToolbarIconText",
- (BonoboUIListenerFn)view_menu_item_toggled_cb,
- (gpointer)win);
- bonobo_ui_component_add_listener (ui_component, "MainToolbarTooltips",
- (BonoboUIListenerFn)view_menu_item_toggled_cb,
- (gpointer)win);
-
- /* Set the toolbar style according to prefs */
- set_app_drawing_toolbar_style (ui_component);
-
- /* Add listener for the view menu */
- bonobo_ui_component_add_listener (ui_component, "ViewDrawingToolbar",
- (BonoboUIListenerFn)view_menu_item_toggled_cb,
- (gpointer)win);
-
- bonobo_ui_component_add_listener (ui_component, "DrawingToolbarSystem",
- (BonoboUIListenerFn)view_menu_item_toggled_cb,
- (gpointer)win);
- bonobo_ui_component_add_listener (ui_component, "DrawingToolbarIcon",
- (BonoboUIListenerFn)view_menu_item_toggled_cb,
- (gpointer)win);
- bonobo_ui_component_add_listener (ui_component, "DrawingToolbarIconText",
- (BonoboUIListenerFn)view_menu_item_toggled_cb,
- (gpointer)win);
- bonobo_ui_component_add_listener (ui_component, "DrawingToolbarTooltips",
- (BonoboUIListenerFn)view_menu_item_toggled_cb,
- (gpointer)win);
-
- /* Set the toolbar style according to prefs */
- set_app_property_toolbar_style (ui_component);
-
- /* Add listener for the view menu */
- bonobo_ui_component_add_listener (ui_component, "ViewPropertyToolbar",
- (BonoboUIListenerFn)view_menu_item_toggled_cb,
- (gpointer)win);
-
- bonobo_ui_component_add_listener (ui_component, "PropertyToolbarTooltips",
- (BonoboUIListenerFn)view_menu_item_toggled_cb,
- (gpointer)win);
+ gtk_ui_manager_insert_action_group (ui, actions, 0);
+ gtk_window_add_accel_group (window, gtk_ui_manager_get_accel_group (ui));
+ if (!gtk_ui_manager_add_ui_from_string (ui, ui_info, strlen (ui_info), &error)) {
+ g_message ("building menus failed: %s", error->message);
+ g_error_free (error);
+ }
+ /* Set the toolbar styles according to prefs */
+ set_app_main_toolbar_style (ui);
+ set_app_drawing_toolbar_style (ui);
+
/* Set view grid and markup visibility according to prefs */
- set_view_style (ui_component);
+ set_view_style (ui);
- /* Add listener for the view grid & markup */
- bonobo_ui_component_add_listener (ui_component, "ViewGrid",
- (BonoboUIListenerFn)view_menu_item_toggled_cb,
- (gpointer)win);
- bonobo_ui_component_add_listener (ui_component, "ViewMarkup",
- (BonoboUIListenerFn)view_menu_item_toggled_cb,
- (gpointer)win);
-
- gl_ui_util_set_verb_list_sensitive (ui_component, doc_verbs, FALSE);
-
- /* Status bar */
- gl_debug (DEBUG_UI, "START Setup status bar.");
-
- bonobo_ui_component_set_prop (ui_component,
- "/status", "hidden", "0", NULL);
-
- control = bonobo_control_new (cursor_info_frame);
- bonobo_ui_component_object_set (ui_component,
- "/status/Cursor", BONOBO_OBJREF (control), NULL);
- bonobo_object_unref (BONOBO_OBJECT (control));
- bonobo_ui_component_set_prop (ui_component,
- "/status/Cursor", "hidden", "0", NULL);
-
- control = bonobo_control_new (zoom_info_frame);
- bonobo_ui_component_object_set (ui_component,
- "/status/Zoom", BONOBO_OBJREF (control), NULL);
- bonobo_object_unref (BONOBO_OBJECT (control));
- bonobo_ui_component_set_prop (ui_component,
- "/status/Zoom", "hidden", "0", NULL);
-
- gl_debug (DEBUG_UI, "END Setup status bar.");
-
-
- /* add an eggRecentView object */
- recent_model = gl_recent_get_model ();
- recent_view =
- EGG_RECENT_VIEW (egg_recent_view_bonobo_new (ui_component,
- "/menu/File/Recents"));
- egg_recent_view_set_model (recent_view, recent_model);
-
- g_signal_connect (G_OBJECT (recent_view), "activate",
- G_CALLBACK (gl_file_open_recent), win);
-
- /* Squirrel away a copy to be unreferenced in gl_ui_unref() */
- g_object_set_data (G_OBJECT (ui_component), "recent-view", recent_view);
+ gl_ui_util_set_verb_list_sensitive (ui, doc_verbs, FALSE);
gl_debug (DEBUG_UI, "END");
+
+ return ui;
}
/*****************************************************************************/
/* Unref wrapper. */
/*****************************************************************************/
void
-gl_ui_unref (BonoboUIComponent *ui_component)
+gl_ui_unref (GtkUIManager *ui)
{
- EggRecentView *recent_view;
+ gl_debug (DEBUG_UI, "START");
- /* Pull out recent view to unreference. */
- recent_view = g_object_get_data (G_OBJECT(ui_component), "recent-view");
- if (recent_view) {
- g_object_unref (recent_view);
- }
+ g_object_unref(ui);
- bonobo_object_unref(ui_component);
+ gl_debug (DEBUG_UI, "END");
}
/*****************************************************************************/
/* Update all verbs of given UI component. */
/*****************************************************************************/
void
-gl_ui_update_all (BonoboUIComponent *ui_component,
- glView *view)
+gl_ui_update_all (GtkUIManager *ui,
+ glView *view)
{
glLabel *label;
gl_debug (DEBUG_UI, "START");
- bonobo_ui_component_freeze (ui_component, NULL);
-
- gl_ui_util_set_verb_list_sensitive (ui_component, doc_verbs, TRUE);
+ gl_ui_util_set_verb_list_sensitive (ui, doc_verbs, TRUE);
label = view->label;
g_return_if_fail (label != NULL);
- gl_ui_util_set_verb_sensitive (ui_component, "/commands/EditUndo",
+ gl_ui_util_set_verb_sensitive (ui, "/ui/MenuBar/EditMenu/EditUndo",
gl_label_can_undo (label));
- gl_ui_util_set_verb_sensitive (ui_component, "/commands/EditRedo",
+ gl_ui_util_set_verb_sensitive (ui, "/ui/MenuBar/EditMenu/EditRedo",
gl_label_can_redo (label));
- gl_ui_util_set_verb_list_sensitive (ui_component,
- doc_modified_verbs,
+ gl_ui_util_set_verb_list_sensitive (ui, doc_modified_verbs,
gl_label_is_modified (label));
- gl_ui_util_set_verb_sensitive (ui_component, "/commands/ToolsZoomIn",
+ gl_ui_util_set_verb_sensitive (ui, "/ui/MenuBar/ViewMenu/ViewZoomIn",
!gl_view_is_zoom_max (view));
- gl_ui_util_set_verb_sensitive (ui_component, "/commands/ToolsZoomOut",
+ gl_ui_util_set_verb_sensitive (ui, "/ui/MenuBar/ViewMenu/ViewZoomOut",
!gl_view_is_zoom_min (view));
- gl_ui_util_set_verb_list_sensitive (ui_component,
- selection_verbs,
+ gl_ui_util_set_verb_list_sensitive (ui, selection_verbs,
!gl_view_is_selection_empty (view));
- gl_ui_util_set_verb_list_sensitive (ui_component,
- atomic_selection_verbs,
+ gl_ui_util_set_verb_list_sensitive (ui, atomic_selection_verbs,
gl_view_is_selection_atomic (view));
- gl_ui_util_set_verb_list_sensitive (ui_component,
- multi_selection_verbs,
+ gl_ui_util_set_verb_list_sensitive (ui, multi_selection_verbs,
!gl_view_is_selection_empty (view)
&& !gl_view_is_selection_atomic (view));
- bonobo_ui_component_thaw (ui_component, NULL);
-
gl_debug (DEBUG_UI, "END");
}
/* Update all verbs of given UI component to "no document" state. */
/*****************************************************************************/
void
-gl_ui_update_nodoc (BonoboUIComponent *ui_component)
+gl_ui_update_nodoc (GtkUIManager *ui)
{
gl_debug (DEBUG_UI, "START");
- bonobo_ui_component_freeze (ui_component, NULL);
-
- gl_ui_util_set_verb_list_sensitive (ui_component, doc_verbs, FALSE);
-
- bonobo_ui_component_thaw (ui_component, NULL);
+ gl_ui_util_set_verb_list_sensitive (ui, doc_verbs, FALSE);
gl_debug (DEBUG_UI, "END");
}
/* Update label modified verbs of given UI component. */
/*****************************************************************************/
void
-gl_ui_update_modified_verbs (BonoboUIComponent *ui_component,
- glLabel *label)
+gl_ui_update_modified_verbs (GtkUIManager *ui,
+ glLabel *label)
{
gl_debug (DEBUG_UI, "START");
- bonobo_ui_component_freeze (ui_component, NULL);
-
- gl_ui_util_set_verb_list_sensitive (ui_component,
+ gl_ui_util_set_verb_list_sensitive (ui,
doc_modified_verbs,
gl_label_is_modified (label));
- bonobo_ui_component_thaw (ui_component, NULL);
-
gl_debug (DEBUG_UI, "END");
}
/* Update verbs associated with selection state of given UI component. */
/*****************************************************************************/
void
-gl_ui_update_selection_verbs (BonoboUIComponent *ui_component,
- glView *view)
+gl_ui_update_selection_verbs (GtkUIManager *ui,
+ glView *view)
{
gl_debug (DEBUG_UI, "START");
- bonobo_ui_component_freeze (ui_component, NULL);
-
- gl_ui_util_set_verb_list_sensitive (ui_component,
- selection_verbs,
+ gl_ui_util_set_verb_list_sensitive (ui, selection_verbs,
!gl_view_is_selection_empty (view));
- gl_ui_util_set_verb_list_sensitive (ui_component,
- atomic_selection_verbs,
+ gl_ui_util_set_verb_list_sensitive (ui, atomic_selection_verbs,
gl_view_is_selection_atomic (view));
- gl_ui_util_set_verb_list_sensitive (ui_component,
- multi_selection_verbs,
+ gl_ui_util_set_verb_list_sensitive (ui, multi_selection_verbs,
!gl_view_is_selection_empty (view)
&& !gl_view_is_selection_atomic (view));
- bonobo_ui_component_thaw (ui_component, NULL);
-
gl_debug (DEBUG_UI, "END");
}
/* Update verbs associated with zoom level of given UI component. */
/*****************************************************************************/
void
-gl_ui_update_zoom_verbs (BonoboUIComponent *ui_component,
- glView *view)
+gl_ui_update_zoom_verbs (GtkUIManager *ui,
+ glView *view)
{
gl_debug (DEBUG_UI, "START");
- bonobo_ui_component_freeze (ui_component, NULL);
-
- gl_ui_util_set_verb_sensitive (ui_component, "/commands/ToolsZoomIn",
+ gl_ui_util_set_verb_sensitive (ui, "/ui/MenuBar/ViewMenu/ViewZoomIn",
!gl_view_is_zoom_max (view));
- gl_ui_util_set_verb_sensitive (ui_component, "/commands/ToolsZoomOut",
+ gl_ui_util_set_verb_sensitive (ui, "/ui/MenuBar/ViewMenu/ViewZoomOut",
!gl_view_is_zoom_min (view));
- bonobo_ui_component_thaw (ui_component, NULL);
-
gl_debug (DEBUG_UI, "END");
}
/* Update undo/redo verbs of given UI component. */
/*****************************************************************************/
void
-gl_ui_update_undo_redo_verbs (BonoboUIComponent *ui_component,
- glLabel *label)
+gl_ui_update_undo_redo_verbs (GtkUIManager *ui,
+ glLabel *label)
{
gl_debug (DEBUG_UI, "START");
- bonobo_ui_component_freeze (ui_component, NULL);
-
- gl_ui_util_set_verb_sensitive (ui_component,
- "/commands/EditUndo",
+ gl_ui_util_set_verb_sensitive (ui, "/ui/MenuBar/EditMenu/EditUndo",
gl_label_can_undo (label));
- gl_ui_util_set_verb_sensitive (ui_component,
- "/commands/EditRedo",
+ gl_ui_util_set_verb_sensitive (ui, "/ui/MenuBar/EditMenu/EditRedo",
gl_label_can_redo (label));
- bonobo_ui_component_thaw (ui_component, NULL);
-
gl_debug (DEBUG_UI, "END");
}
/* PRIVATE. View menu item toggled callback. */
/*---------------------------------------------------------------------------*/
static void
-view_menu_item_toggled_cb (BonoboUIComponent *ui_component,
- const char *path,
- Bonobo_UIComponent_EventType type,
- const char *state,
- BonoboWindow *win)
+view_ui_item_toggled_cb (GtkToggleAction *action,
+ GtkUIManager *ui)
{
- gboolean s;
-
- gl_debug (DEBUG_UI, "");
-
- s = (strcmp (state, "1") == 0);
-
- if (strcmp (path, "ViewMainToolbar") == 0)
- {
- gl_prefs->main_toolbar_visible = s;
- set_app_main_toolbar_style (ui_component);
- gl_prefs_model_save_settings (gl_prefs);
-
- return;
- }
-
- if (s && (strcmp (path, "MainToolbarSystem") == 0))
- {
- gl_prefs->main_toolbar_buttons_style = GL_TOOLBAR_SYSTEM;
- set_app_main_toolbar_style (ui_component);
- gl_prefs_model_save_settings (gl_prefs);
-
- return;
- }
-
- if (s && (strcmp (path, "MainToolbarIcon") == 0))
- {
- gl_prefs->main_toolbar_buttons_style = GL_TOOLBAR_ICONS;
- set_app_main_toolbar_style (ui_component);
- gl_prefs_model_save_settings (gl_prefs);
-
- return;
- }
-
- if (s && (strcmp (path, "MainToolbarIconText") == 0))
- {
- gl_prefs->main_toolbar_buttons_style = GL_TOOLBAR_ICONS_AND_TEXT;
- set_app_main_toolbar_style (ui_component);
- gl_prefs_model_save_settings (gl_prefs);
-
- return;
- }
+ const gchar *name;
+ gboolean state;
- if (strcmp (path, "MainToolbarTooltips") == 0)
- {
- gl_prefs->main_toolbar_view_tooltips = s;
- set_app_main_toolbar_style (ui_component);
- gl_prefs_model_save_settings (gl_prefs);
-
- return;
- }
-
- if (strcmp (path, "ViewDrawingToolbar") == 0)
- {
- gl_prefs->drawing_toolbar_visible = s;
- set_app_drawing_toolbar_style (ui_component);
- gl_prefs_model_save_settings (gl_prefs);
+ gl_debug (DEBUG_UI, "START");
- return;
- }
+ g_return_if_fail (action && GTK_IS_TOGGLE_ACTION (action));
- if (strcmp (path, "DrawingToolbarTooltips") == 0)
- {
- gl_prefs->drawing_toolbar_view_tooltips = s;
- set_app_drawing_toolbar_style (ui_component);
- gl_prefs_model_save_settings (gl_prefs);
+ name = gtk_action_get_name (GTK_ACTION (action));
+ state = gtk_toggle_action_get_active (action);
- return;
- }
+ gl_debug (DEBUG_UI, "Action = %s, State = %d", name, state);
- if (strcmp (path, "ViewPropertyToolbar") == 0)
+ if (strcmp (name, "ViewMainToolBar") == 0)
{
- gl_prefs->property_toolbar_visible = s;
- set_app_property_toolbar_style (ui_component);
+ gl_prefs->main_toolbar_visible = state;
+ set_app_main_toolbar_style (ui);
gl_prefs_model_save_settings (gl_prefs);
-
- return;
}
- if (strcmp (path, "PropertyToolbarTooltips") == 0)
+ if (strcmp (name, "ViewMainToolBarToolTips") == 0)
{
- gl_prefs->property_toolbar_view_tooltips = s;
- set_app_property_toolbar_style (ui_component);
+ gl_prefs->main_toolbar_view_tooltips = state;
+ set_app_main_toolbar_style (ui);
gl_prefs_model_save_settings (gl_prefs);
-
- return;
}
- if (strcmp (path, "ViewGrid") == 0)
+ if (strcmp (name, "ViewDrawingToolBar") == 0)
{
- gl_prefs->grid_visible = s;
- if (s) {
- gl_view_show_grid (GL_VIEW(GL_WINDOW(win)->view));
- } else {
- gl_view_hide_grid (GL_VIEW(GL_WINDOW(win)->view));
- }
+ gl_prefs->drawing_toolbar_visible = state;
+ set_app_drawing_toolbar_style (ui);
gl_prefs_model_save_settings (gl_prefs);
-
- return;
}
- if (strcmp (path, "ViewMarkup") == 0)
+ if (strcmp (name, "ViewDrawingToolBarToolTips") == 0)
{
- gl_prefs->markup_visible = s;
- if (s) {
- gl_view_show_markup (GL_VIEW(GL_WINDOW(win)->view));
- } else {
- gl_view_hide_markup (GL_VIEW(GL_WINDOW(win)->view));
- }
+ gl_prefs->drawing_toolbar_view_tooltips = state;
+ set_app_drawing_toolbar_style (ui);
gl_prefs_model_save_settings (gl_prefs);
-
- return;
}
+ gl_debug (DEBUG_UI, "");
}
/*---------------------------------------------------------------------------*/
/* PRIVATE. Set main toolbar style. */
/*---------------------------------------------------------------------------*/
static void
-set_app_main_toolbar_style (BonoboUIComponent *ui_component)
+set_app_main_toolbar_style (GtkUIManager *ui)
{
- GConfClient *client;
- gboolean labels;
+ GtkWidget *toolbar;
gl_debug (DEBUG_UI, "START");
- g_return_if_fail (BONOBO_IS_UI_COMPONENT (ui_component));
+ g_return_if_fail (ui && GTK_IS_UI_MANAGER (ui));
- bonobo_ui_component_freeze (ui_component, NULL);
-
/* Updated view menu */
- gl_ui_util_set_verb_state (ui_component,
- "/commands/ViewMainToolbar",
+ gl_ui_util_set_verb_state (ui, "/ui/ViewMenu/ViewMainToolBar",
gl_prefs->main_toolbar_visible);
- gl_ui_util_set_verb_sensitive (ui_component,
- "/commands/MainToolbarSystem",
+ gl_ui_util_set_verb_sensitive (ui, "/ui/ViewMenu/ViewMainToolBarToolTips",
gl_prefs->main_toolbar_visible);
- gl_ui_util_set_verb_sensitive (ui_component,
- "/commands/MainToolbarIcon",
- gl_prefs->main_toolbar_visible);
- gl_ui_util_set_verb_sensitive (ui_component,
- "/commands/MainToolbarIconText",
- gl_prefs->main_toolbar_visible);
- gl_ui_util_set_verb_sensitive (ui_component,
- "/commands/MainToolbarTooltips",
- gl_prefs->main_toolbar_visible);
-
- gl_ui_util_set_verb_state (ui_component,
- "/commands/MainToolbarSystem",
- gl_prefs->main_toolbar_buttons_style == GL_TOOLBAR_SYSTEM);
-
- gl_ui_util_set_verb_state (ui_component,
- "/commands/MainToolbarIcon",
- gl_prefs->main_toolbar_buttons_style == GL_TOOLBAR_ICONS);
- gl_ui_util_set_verb_state (ui_component,
- "/commands/MainToolbarIconText",
- gl_prefs->main_toolbar_buttons_style == GL_TOOLBAR_ICONS_AND_TEXT);
-
- gl_ui_util_set_verb_state (ui_component,
- "/commands/MainToolbarTooltips",
+ gl_ui_util_set_verb_state (ui, "/ui/ViewMenu/ViewMainToolBarToolTips",
gl_prefs->main_toolbar_view_tooltips);
- /* Actually update main_toolbar style */
- bonobo_ui_component_set_prop (
- ui_component, "/MainToolbar",
- "tips", gl_prefs->main_toolbar_view_tooltips ? "1" : "0",
- NULL);
-
- switch (gl_prefs->main_toolbar_buttons_style)
- {
- case GL_TOOLBAR_SYSTEM:
-
- client = gconf_client_get_default ();
- if (client == NULL)
- goto error;
+ toolbar = gtk_ui_manager_get_widget (ui, "/MainToolBar");
- labels = gconf_client_get_bool (client,
- "/desktop/gnome/interface/toolbar-labels", NULL);
+ gtk_toolbar_set_tooltips (GTK_TOOLBAR (toolbar),
+ gl_prefs->main_toolbar_view_tooltips);
- g_object_unref (G_OBJECT (client));
-
- if (labels)
- {
- bonobo_ui_component_set_prop (
- ui_component, "/MainToolbar", "look", "both", NULL);
-
- }
- else
- {
- bonobo_ui_component_set_prop (
- ui_component, "/MainToolbar", "look", "icons", NULL);
- }
-
- break;
-
- case GL_TOOLBAR_ICONS:
- bonobo_ui_component_set_prop (
- ui_component, "/MainToolbar", "look", "icon", NULL);
-
- break;
-
- case GL_TOOLBAR_ICONS_AND_TEXT:
- bonobo_ui_component_set_prop (
- ui_component, "/MainToolbar", "look", "both", NULL);
-
- break;
- default:
- goto error;
- break;
+ if (gl_prefs->main_toolbar_visible) {
+ gtk_widget_show_all (toolbar);
+ } else {
+ gtk_widget_hide (toolbar);
}
- bonobo_ui_component_set_prop (
- ui_component, "/MainToolbar",
- "hidden", gl_prefs->main_toolbar_visible ? "0":"1", NULL);
-
- error:
- bonobo_ui_component_thaw (ui_component, NULL);
-
gl_debug (DEBUG_UI, "END");
}
/* PRIVATE. Set drawing toolbar style. */
/*---------------------------------------------------------------------------*/
static void
-set_app_drawing_toolbar_style (BonoboUIComponent *ui_component)
+set_app_drawing_toolbar_style (GtkUIManager *ui)
{
- GConfClient *client;
- gboolean labels;
+ GtkWidget *toolbar;
gl_debug (DEBUG_UI, "START");
- g_return_if_fail (BONOBO_IS_UI_COMPONENT(ui_component));
+ g_return_if_fail (ui && GTK_IS_UI_MANAGER (ui));
- bonobo_ui_component_freeze (ui_component, NULL);
-
/* Updated view menu */
- gl_ui_util_set_verb_state (ui_component,
- "/commands/ViewDrawingToolbar",
+ gl_ui_util_set_verb_state (ui, "/ui/MenuBar/ViewMenu/ViewDrawingToolBar",
gl_prefs->drawing_toolbar_visible);
- gl_ui_util_set_verb_sensitive (ui_component,
- "/commands/DrawingToolbarSystem",
- gl_prefs->drawing_toolbar_visible);
- gl_ui_util_set_verb_sensitive (ui_component,
- "/commands/DrawingToolbarIcon",
- gl_prefs->drawing_toolbar_visible);
- gl_ui_util_set_verb_sensitive (ui_component,
- "/commands/DrawingToolbarIconText",
- gl_prefs->drawing_toolbar_visible);
- gl_ui_util_set_verb_sensitive (ui_component,
- "/commands/DrawingToolbarTooltips",
+ gl_ui_util_set_verb_sensitive (ui, "/ui/MenuBar/ViewMenu/ViewDrawingToolBarToolTips",
gl_prefs->drawing_toolbar_visible);
- gl_ui_util_set_verb_state (ui_component,
- "/commands/DrawingToolbarTooltips",
- gl_prefs->drawing_toolbar_view_tooltips);
+ gl_ui_util_set_verb_state (ui, "/ui/MenuBar/ViewMenuDrawingToolBarToolTips",
+ gl_prefs->drawing_toolbar_view_tooltips);
- /* Actually update drawing_toolbar style */
- bonobo_ui_component_set_prop (
- ui_component, "/DrawingToolbar",
- "tips", gl_prefs->drawing_toolbar_view_tooltips ? "1" : "0",
- NULL);
-
- bonobo_ui_component_set_prop (
- ui_component, "/DrawingToolbar",
- "hidden", gl_prefs->drawing_toolbar_visible ? "0":"1", NULL);
-
- error:
- bonobo_ui_component_thaw (ui_component, NULL);
-
- gl_debug (DEBUG_UI, "END");
-}
-
-/*---------------------------------------------------------------------------*/
-/* PRIVATE. Set property toolbar style. */
-/*---------------------------------------------------------------------------*/
-static void
-set_app_property_toolbar_style (BonoboUIComponent *ui_component)
-{
- GConfClient *client;
- gboolean labels;
-
- gl_debug (DEBUG_UI, "START");
-
- g_return_if_fail (BONOBO_IS_UI_COMPONENT(ui_component));
-
- bonobo_ui_component_freeze (ui_component, NULL);
-
- /* Updated view menu */
- gl_ui_util_set_verb_state (ui_component,
- "/commands/ViewPropertyToolbar",
- gl_prefs->property_toolbar_visible);
+ toolbar = gtk_ui_manager_get_widget (ui, "/DrawingToolBar");
- gl_ui_util_set_verb_sensitive (ui_component,
- "/commands/PropertyToolbarTooltips",
- gl_prefs->property_toolbar_visible);
+ gtk_toolbar_set_tooltips (GTK_TOOLBAR (toolbar),
+ gl_prefs->drawing_toolbar_view_tooltips);
- gl_ui_util_set_verb_state (ui_component,
- "/commands/PropertyToolbarTooltips",
- gl_prefs->property_toolbar_view_tooltips);
+ gtk_toolbar_set_style (GTK_TOOLBAR (toolbar), GTK_TOOLBAR_ICONS);
+ if (gl_prefs->drawing_toolbar_visible) {
+ gtk_widget_show_all (toolbar);
+ } else {
+ gtk_widget_hide (toolbar);
+ }
- /* Actually update property_toolbar style */
- bonobo_ui_component_set_prop (
- ui_component, "/PropertyToolbar",
- "tips", gl_prefs->property_toolbar_view_tooltips ? "1" : "0",
- NULL);
-
- bonobo_ui_component_set_prop (
- ui_component, "/PropertyToolbar",
- "hidden", gl_prefs->property_toolbar_visible ? "0":"1", NULL);
-
- bonobo_ui_component_thaw (ui_component, NULL);
-
gl_debug (DEBUG_UI, "END");
}
/* PRIVATE. Set visibility of grid and markup. */
/*---------------------------------------------------------------------------*/
static void
-set_view_style (BonoboUIComponent *ui_component)
+set_view_style (GtkUIManager *ui)
{
- GConfClient *client;
- gboolean labels;
-
gl_debug (DEBUG_UI, "START");
- g_return_if_fail (BONOBO_IS_UI_COMPONENT(ui_component));
+ g_return_if_fail (ui && GTK_IS_UI_MANAGER(ui));
- bonobo_ui_component_freeze (ui_component, NULL);
-
- gl_ui_util_set_verb_state (ui_component,
- "/commands/ViewGrid",
+ gl_ui_util_set_verb_state (ui, "/ui/MenuBar/ViewMenu/ViewGrid",
gl_prefs->grid_visible);
- gl_ui_util_set_verb_state (ui_component,
- "/commands/ViewMarkup",
+ gl_ui_util_set_verb_state (ui, "/ui/MenuBar/ViewMenu/ViewMarkup",
gl_prefs->markup_visible);
- error:
- bonobo_ui_component_thaw (ui_component, NULL);
-
gl_debug (DEBUG_UI, "END");
}
-
-/*
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/**
* (GLABELS) Label and Business Card Creation program for GNOME
*
* ui.h: GLabels UI module header file
#ifndef __GL_UI_H__
#define __GL_UI_H__
-#include <bonobo/bonobo-ui-component.h>
-#include <bonobo/bonobo-ui-engine.h>
-#include <bonobo/bonobo-window.h>
+#include <gtk/gtkuimanager.h>
+#include <gtk/gtkwindow.h>
#include "view.h"
G_BEGIN_DECLS
-void gl_ui_init (BonoboUIComponent *ui_component,
- BonoboWindow *win,
- GtkWidget *cursor_info_frame,
- GtkWidget *zoom_info_frame);
+GtkUIManager *gl_ui_new (GtkWindow *window);
-void gl_ui_unref (BonoboUIComponent *ui_component);
+void gl_ui_unref (GtkUIManager *ui);
-void gl_ui_update_all (BonoboUIComponent *ui_component,
- glView *view);
+void gl_ui_update_all (GtkUIManager *ui,
+ glView *view);
-void gl_ui_update_nodoc (BonoboUIComponent *ui_component);
+void gl_ui_update_nodoc (GtkUIManager *ui);
-void gl_ui_update_modified_verbs (BonoboUIComponent *ui_component,
- glLabel *label);
+void gl_ui_update_modified_verbs (GtkUIManager *ui,
+ glLabel *label);
-void gl_ui_update_selection_verbs (BonoboUIComponent *ui_component,
- glView *view);
+void gl_ui_update_selection_verbs (GtkUIManager *ui,
+ glView *view);
-void gl_ui_update_zoom_verbs (BonoboUIComponent *ui_component,
- glView *view);
+void gl_ui_update_zoom_verbs (GtkUIManager *ui,
+ glView *view);
-void gl_ui_update_undo_redo_verbs (BonoboUIComponent *ui_component,
- glLabel *label);
+void gl_ui_update_undo_redo_verbs (GtkUIManager *ui,
+ glLabel *label);
G_END_DECLS
-/*
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/**
* (GLABELS) Label and Business Card Creation program for GNOME
*
* window.c: a gLabels app window
#include "window.h"
#include <glib/gi18n.h>
+#include <gtk/gtkvbox.h>
+#include <gtk/gtkhbox.h>
#include <gtk/gtklabel.h>
#include <gtk/gtkframe.h>
#include "ui.h"
+#include "ui-commands.h"
#include "util.h"
#include "xml-label.h"
#include "prefs.h"
#include "file.h"
+#include "recent.h"
#include "debug.h"
/*============================================================================*/
/* Private globals */
/*============================================================================*/
-static BonoboWindowClass *parent_class;
+static GtkWindowClass *parent_class;
static GList *window_list = NULL;
static void modified_changed_cb (glLabel *label,
glWindow *window);
+static char *recent_tooltip_func (EggRecentItem *item,
+ gpointer user_data);
+
\f
/****************************************************************************/
/* Boilerplate Object stuff. */
NULL
};
- type = g_type_register_static (BONOBO_TYPE_WINDOW,
+ type = g_type_register_static (GTK_TYPE_WINDOW,
"glWindow", &info, 0);
}
static void
gl_window_init (glWindow *window)
{
- BonoboUIContainer *ui_container;
- BonoboUIComponent *ui_component;
+ GtkWidget *vbox1;
+ GtkUIManager *ui;
+ GtkWidget *status_hbox;
gl_debug (DEBUG_WINDOW, "START");
- ui_container = bonobo_window_get_ui_container(BONOBO_WINDOW(window));
- ui_component = bonobo_ui_component_new_default ();
- bonobo_ui_component_set_container (ui_component,
- BONOBO_OBJREF (ui_container),
- NULL);
-
- window->cursor_info = gtk_label_new (NULL);
- gtk_widget_set_size_request (window->cursor_info, CURSOR_INFO_WIDTH, -1);
- window->cursor_info_frame = gtk_frame_new (NULL);
- gtk_frame_set_shadow_type (GTK_FRAME(window->cursor_info_frame), GTK_SHADOW_IN);
- gtk_container_add (GTK_CONTAINER(window->cursor_info_frame), window->cursor_info);
- gtk_widget_show_all (window->cursor_info_frame);
+ vbox1 = gtk_vbox_new (FALSE, 0);
+ gtk_container_add (GTK_CONTAINER (window), vbox1);
+
+ window->ui = ui = gl_ui_new (GTK_WINDOW (window));
+ gtk_box_pack_start (GTK_BOX (vbox1),
+ gtk_ui_manager_get_widget (ui, "/MenuBar"),
+ FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox1),
+ gtk_ui_manager_get_widget (ui, "/MainToolBar"),
+ FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox1),
+ gtk_ui_manager_get_widget (ui, "/DrawingToolBar"),
+ FALSE, FALSE, 0);
+
+ /* add an eggRecentView */
+ window->recent_view =
+ egg_recent_view_uimanager_new (ui,
+ "/ui/MenuBar/FileMenu/FileRecentsMenu/FileRecentsPlaceHolder",
+ G_CALLBACK (gl_ui_cmd_file_open_recent),
+ window);
+ egg_recent_view_uimanager_show_icons (window->recent_view, FALSE);
+ egg_recent_view_uimanager_set_tooltip_func (window->recent_view,
+ recent_tooltip_func,
+ NULL);
+ egg_recent_view_set_model (EGG_RECENT_VIEW (window->recent_view),
+ gl_recent_get_model ());
+
+
+ window->hbox = gtk_hbox_new (FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox1), window->hbox, TRUE, TRUE, 0);
+
+ window->sidebar = GL_UI_SIDEBAR (gl_ui_sidebar_new ());
+ gtk_box_pack_end (GTK_BOX (window->hbox), GTK_WIDGET (window->sidebar), FALSE, FALSE, 0);
+
+ window->property_bar = GL_UI_PROPERTY_BAR (gl_ui_property_bar_new ());
+ gtk_box_pack_start (GTK_BOX (vbox1), GTK_WIDGET (window->property_bar), FALSE, FALSE, 0);
+
+ status_hbox = gtk_hbox_new (FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox1), status_hbox, FALSE, FALSE, 0);
window->zoom_info = gtk_label_new (NULL);
gtk_widget_set_size_request (window->zoom_info, ZOOM_INFO_WIDTH, -1);
gtk_frame_set_shadow_type (GTK_FRAME(window->zoom_info_frame), GTK_SHADOW_IN);
gtk_container_add (GTK_CONTAINER(window->zoom_info_frame), window->zoom_info);
gtk_widget_show_all (window->zoom_info_frame);
+ gtk_box_pack_end (GTK_BOX (status_hbox),
+ window->zoom_info_frame,
+ FALSE, FALSE, 0);
- gl_ui_init (ui_component,
- BONOBO_WINDOW (window),
- window->cursor_info_frame,
- window->zoom_info_frame);
-
- window->property_bar =
- GL_UI_PROPERTY_BAR(gl_ui_property_bar_new (ui_component));
- window->sidebar =
- GL_UI_SIDEBAR(gl_ui_sidebar_new (ui_component));
+ window->cursor_info = gtk_label_new (NULL);
+ gtk_widget_set_size_request (window->cursor_info, CURSOR_INFO_WIDTH, -1);
+ window->cursor_info_frame = gtk_frame_new (NULL);
+ gtk_frame_set_shadow_type (GTK_FRAME(window->cursor_info_frame), GTK_SHADOW_IN);
+ gtk_container_add (GTK_CONTAINER(window->cursor_info_frame), window->cursor_info);
+ gtk_widget_show_all (window->cursor_info_frame);
+ gtk_box_pack_end (GTK_BOX (status_hbox),
+ window->cursor_info_frame,
+ FALSE, FALSE, 0);
gtk_window_set_default_size (GTK_WINDOW (window),
DEFAULT_WINDOW_WIDTH,
g_signal_connect (G_OBJECT(window), "delete-event",
G_CALLBACK(window_delete_event_cb), NULL);
- window->uic = ui_component;
window->view = NULL;
window_list = g_list_append (window_list, window);
window = GL_WINDOW (gtk_object);
window_list = g_list_remove (window_list, window);
- if (window->uic) {
- gl_ui_unref(window->uic);
- window->uic = NULL;
+ if (window->recent_view) {
+ g_object_unref (window->recent_view);
+ window->recent_view = NULL;
+ }
+
+ if (window->ui) {
+ gl_ui_unref(window->ui);
+ window->ui = NULL;
}
if (GTK_OBJECT_CLASS (parent_class)->destroy) {
gl_debug (DEBUG_WINDOW, "START");
- window = g_object_new (gl_window_get_type (),
- "win_name", "glabels",
+ window = g_object_new (GL_TYPE_WINDOW,
"title", _("(none) - gLabels"),
NULL);
}
window->view = gl_view_new (label);
- bonobo_window_set_contents (BONOBO_WINDOW(window), window->view);
+ gtk_box_pack_start (GTK_BOX (window->hbox), window->view,TRUE, TRUE, 0);
gtk_widget_show_all (window->view);
gl_view_hide_markup (GL_VIEW(window->view));
}
- gl_ui_update_all (window->uic, GL_VIEW(window->view));
+ gl_ui_update_all (window->ui, GL_VIEW(window->view));
gl_ui_property_bar_set_view (window->property_bar, GL_VIEW(window->view));
gl_ui_sidebar_set_view (window->sidebar, GL_VIEW(window->view));
g_return_if_fail (view && GL_IS_VIEW (view));
g_return_if_fail (window && GL_IS_WINDOW (window));
- gl_ui_update_selection_verbs (window->uic, view);
+ gl_ui_update_selection_verbs (window->ui, view);
gl_debug (DEBUG_WINDOW, "END");
}
gtk_label_set_text (GTK_LABEL(window->zoom_info), string);
g_free (string);
- gl_ui_update_zoom_verbs (window->uic, view);
+ gl_ui_update_zoom_verbs (window->ui, view);
gl_debug (DEBUG_WINDOW, "END");
}
set_window_title (window, label);
- gl_ui_update_modified_verbs (window->uic, label);
+ gl_ui_update_modified_verbs (window->ui, label);
gl_debug (DEBUG_WINDOW, "END");
}
+
+/*---------------------------------------------------------------------------*/
+/* PRIVATE. Tooltip function for recent file menu items. */
+/*---------------------------------------------------------------------------*/
+static char *
+recent_tooltip_func (EggRecentItem *item, gpointer user_data)
+{
+ char *tip;
+ char *uri_for_display;
+
+ uri_for_display = egg_recent_item_get_uri_for_display (item);
+ g_return_val_if_fail (uri_for_display != NULL, NULL);
+
+ tip = g_strdup_printf (_("Open '%s'"), uri_for_display);
+
+ g_free (uri_for_display);
+
+ return tip;
+}
+
+
-/*
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/**
* (GLABELS) Label and Business Card Creation program for GNOME
*
* window.h: a gLabels app window
#ifndef __WINDOW_H__
#define __WINDOW_H__
-#include <bonobo/bonobo-window.h>
-#include <bonobo/bonobo-ui-component.h>
+#include <gtk/gtkwindow.h>
+#include <gtk/gtkuimanager.h>
+#include "recent-files/egg-recent-view.h"
+#include "recent-files/egg-recent-view-uimanager.h"
#include "view.h"
#include "label.h"
typedef struct _glWindowClass glWindowClass;
struct _glWindow {
- BonoboWindow parent_widget;
+ GtkWindow parent_widget;
+
+ GtkUIManager *ui;
+
+ GtkWidget *view;
- BonoboUIComponent *uic;
+ GtkWidget *hbox;
- GtkWidget *view;
+ glUIPropertyBar *property_bar;
+ glUISidebar *sidebar;
- glUIPropertyBar *property_bar;
- glUISidebar *sidebar;
+ EggRecentViewUIManager *recent_view;
- GtkWidget *cursor_info;
- GtkWidget *cursor_info_frame;
- GtkWidget *zoom_info;
- GtkWidget *zoom_info_frame;
+ GtkWidget *cursor_info;
+ GtkWidget *cursor_info_frame;
+ GtkWidget *zoom_info;
+ GtkWidget *zoom_info_frame;
};
struct _glWindowClass {
- BonoboWindowClass parent_class;
+ GtkWindowClass parent_class;
};
GType gl_window_get_type (void) G_GNUC_CONST;