1 | /* |
---|
2 | * menu/toolbar related code |
---|
3 | * |
---|
4 | * Author: |
---|
5 | * Dietmar Maurer (dietmar@maurer-it.com) |
---|
6 | * |
---|
7 | * Copyright 1999 Maurer IT Systemlösungen (http://www.maurer-it.com) |
---|
8 | */ |
---|
9 | |
---|
10 | #include <config.h> |
---|
11 | #include "ui.h" |
---|
12 | #include "inout.h" |
---|
13 | |
---|
14 | void |
---|
15 | frame_create_ui (Frame *frame) |
---|
16 | { |
---|
17 | Bonobo_UIContainer remote_uic; |
---|
18 | |
---|
19 | g_return_if_fail (frame != NULL); |
---|
20 | |
---|
21 | remote_uic = BONOBO_OBJREF (frame->container); |
---|
22 | |
---|
23 | frame->component = bonobo_ui_component_new ("GShell"); |
---|
24 | bonobo_ui_component_set_container (frame->component, remote_uic); |
---|
25 | |
---|
26 | bonobo_ui_util_set_ui (frame->component, DATADIR, "gshell-ui.xml", "gshell"); |
---|
27 | |
---|
28 | bonobo_ui_component_add_verb_list_with_data (frame->component, gshell_verbs, frame); |
---|
29 | bonobo_ui_component_add_verb_list_with_data (frame->component, inout_verbs, frame); |
---|
30 | |
---|
31 | bonobo_ui_component_thaw (frame->component, NULL); |
---|
32 | } |
---|
33 | |
---|
34 | void |
---|
35 | frame_set_sensitive (Frame *frame, gboolean sensitive) |
---|
36 | { |
---|
37 | char *ssensitive = sensitive ? "1" : "0"; |
---|
38 | |
---|
39 | g_return_if_fail (frame != NULL); |
---|
40 | |
---|
41 | bonobo_ui_component_set_prop (frame->component, "/commands/FileLoad", |
---|
42 | "sensitive", ssensitive, NULL); |
---|
43 | bonobo_ui_component_set_prop (frame->component, "/commands/FilePrint", |
---|
44 | "sensitive", ssensitive, NULL); |
---|
45 | bonobo_ui_component_set_prop (frame->component, "/commands/FileSave", |
---|
46 | "sensitive", ssensitive, NULL); |
---|
47 | bonobo_ui_component_set_prop (frame->component, "/commands/FileSaveAs", |
---|
48 | "sensitive", ssensitive, NULL); |
---|
49 | bonobo_ui_component_set_prop (frame->component, "/commands/FileKill", |
---|
50 | "sensitive", ssensitive, NULL); |
---|
51 | bonobo_ui_component_set_prop (frame->component, "/commands/WindowSplit", |
---|
52 | "sensitive", ssensitive, NULL); |
---|
53 | bonobo_ui_component_set_prop (frame->component, "/commands/WindowOne", |
---|
54 | "sensitive", ssensitive, NULL); |
---|
55 | bonobo_ui_component_set_prop (frame->component, "/commands/WindowZoom", |
---|
56 | "sensitive", ssensitive, NULL); |
---|
57 | } |
---|
58 | |
---|
59 | void |
---|
60 | frame_set_zoomable (Frame *frame, gboolean zoomable) |
---|
61 | { |
---|
62 | char *szoomable = zoomable ? "1" : "0"; |
---|
63 | |
---|
64 | g_return_if_fail (frame != NULL); |
---|
65 | |
---|
66 | bonobo_ui_component_set_prop (frame->component, "/commands/ZoomIn", |
---|
67 | "sensitive", szoomable, NULL); |
---|
68 | bonobo_ui_component_set_prop (frame->component, "/commands/ZoomOut", |
---|
69 | "sensitive", szoomable, NULL); |
---|
70 | bonobo_ui_component_set_prop (frame->component, "/commands/ZoomToFit", |
---|
71 | "sensitive", szoomable, NULL); |
---|
72 | bonobo_ui_component_set_prop (frame->component, "/commands/ZoomToDefault", |
---|
73 | "sensitive", szoomable, NULL); |
---|
74 | } |
---|
75 | |
---|
76 | void |
---|
77 | update_buffer_menu (void) |
---|
78 | { |
---|
79 | GList *f,*b; |
---|
80 | |
---|
81 | /* fixme: set the right menu pixmap (from mime type) */ |
---|
82 | |
---|
83 | for (f = app.frame_list; f; f = f->next) { |
---|
84 | Frame *frame = f->data; |
---|
85 | BonoboUINode *parent; |
---|
86 | |
---|
87 | bonobo_ui_component_rm (frame->component, |
---|
88 | "/menu/Buffers/BufferList/", NULL); |
---|
89 | |
---|
90 | parent = bonobo_ui_util_new_placeholder ("BufferList", FALSE, FALSE); |
---|
91 | |
---|
92 | for (b = app.buffer_list; b; b = b->next) { |
---|
93 | Buffer *buffer = b->data; |
---|
94 | BonoboUINode *node; |
---|
95 | |
---|
96 | node = bonobo_ui_util_new_menu (FALSE, buffer->verb, g_basename (buffer->name), |
---|
97 | NULL, buffer->verb); |
---|
98 | |
---|
99 | bonobo_ui_node_set_data (node, buffer); |
---|
100 | |
---|
101 | bonobo_ui_node_add_child (parent, node); |
---|
102 | } |
---|
103 | |
---|
104 | bonobo_ui_component_set_tree (frame->component, |
---|
105 | "/menu/Buffers/", parent, NULL); |
---|
106 | } |
---|
107 | } |
---|