215 GtkWidget *vbox, *label, *sw;
216 GtkCellRenderer *rend;
218 shell = gtk_dialog_new_with_buttons(
_(
"Edit worklists"),
225 GTK_STOCK_PROPERTIES,
231 gtk_window_set_position(GTK_WINDOW(
shell), GTK_WIN_POS_MOUSE);
233 g_signal_connect(
shell,
"response",
235 g_signal_connect(
shell,
"destroy",
238 vbox = gtk_grid_new();
239 gtk_grid_set_row_spacing(GTK_GRID(vbox), 2);
240 gtk_orientable_set_orientation(GTK_ORIENTABLE(vbox),
241 GTK_ORIENTATION_VERTICAL);
242 gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(
shell))), vbox);
251 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(
list),
FALSE);
255 rend = gtk_cell_renderer_text_new();
256 g_object_set(rend,
"editable",
TRUE, NULL);
257 g_signal_connect(rend,
"edited",
259 gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(
list), -1, NULL,
260 rend,
"text", 0, NULL);
262 sw = gtk_scrolled_window_new(NULL, NULL);
263 gtk_scrolled_window_set_min_content_height(GTK_SCROLLED_WINDOW(sw), 200);
264 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw),
265 GTK_SHADOW_ETCHED_IN);
266 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
267 GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
268 gtk_container_add(GTK_CONTAINER(sw),
list);
270 label = g_object_new(GTK_TYPE_LABEL,
271 "use-underline",
TRUE,
272 "mnemonic-widget",
list,
273 "label",
_(
"_Worklists:"),
274 "xalign", 0.0,
"yalign", 0.5, NULL);
276 gtk_container_add(GTK_CONTAINER(vbox), label);
277 gtk_container_add(GTK_CONTAINER(vbox), sw);
278 gtk_widget_show_all(vbox);
1056 GtkWidget *
editor, *table, *sw, *bbox;
1057 GtkWidget *src_view, *dst_view, *label, *button;
1058 GtkWidget *menubar, *
item, *menu, *image;
1059 GtkWidget *table2, *arrow, *check;
1060 GtkSizeGroup *group;
1061 GtkListStore *src_store, *dst_store;
1066 src_store = gtk_list_store_new(2, G_TYPE_INT, G_TYPE_STRING);
1067 dst_store = gtk_list_store_new(2, G_TYPE_INT, G_TYPE_STRING);
1071 ptr->
src = src_store;
1072 ptr->
dst = dst_store;
1077 gtk_grid_set_row_spacing(GTK_GRID(
editor), 6);
1078 gtk_orientable_set_orientation(GTK_ORIENTABLE(
editor),
1079 GTK_ORIENTATION_VERTICAL);
1081 g_object_set_data(G_OBJECT(
editor),
"data", ptr);
1086 table = gtk_grid_new();
1087 gtk_container_add(GTK_CONTAINER(
editor), table);
1089 group = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
1091 sw = gtk_scrolled_window_new(NULL, NULL);
1092 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw),
1093 GTK_SHADOW_ETCHED_IN);
1094 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
1095 GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
1096 gtk_grid_attach(GTK_GRID(table), sw, 3, 1, 2, 1);
1098 src_view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(src_store));
1101 g_object_unref(src_store);
1103 gtk_widget_set_name(
src_view,
"small_font");
1104 gtk_tree_view_set_tooltip_column(GTK_TREE_VIEW(
src_view), 1);
1107 gtk_container_add(GTK_CONTAINER(sw),
src_view);
1109 label = g_object_new(GTK_TYPE_LABEL,
1110 "use-underline",
TRUE,
1112 "label",
_(
"Source _Tasks:"),
1113 "xalign", 0.0,
"yalign", 0.5, NULL);
1114 gtk_grid_attach(GTK_GRID(table), label, 3, 0, 1, 1);
1116 check = gtk_check_button_new_with_mnemonic(
_(
"Show _Future Targets"));
1117 gtk_grid_attach(GTK_GRID(table), check, 4, 0, 1, 1);
1120 table2 = gtk_grid_new();
1121 gtk_grid_attach(GTK_GRID(table), table2, 2, 1, 1, 1);
1123 button = gtk_button_new();
1124 gtk_widget_set_margin_top(button, 24);
1125 gtk_widget_set_margin_bottom(button, 24);
1127 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
1128 gtk_grid_attach(GTK_GRID(table2), button, 0, 0, 1, 1);
1130 arrow = gtk_arrow_new(GTK_ARROW_LEFT, GTK_SHADOW_NONE);
1131 gtk_container_add(GTK_CONTAINER(button), arrow);
1132 g_signal_connect_swapped(button,
"clicked",
1136 button = gtk_button_new();
1138 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
1139 gtk_grid_attach(GTK_GRID(table2), button, 0, 1, 1, 1);
1141 arrow = gtk_arrow_new(GTK_ARROW_UP, GTK_SHADOW_NONE);
1142 gtk_container_add(GTK_CONTAINER(button), arrow);
1143 g_signal_connect_swapped(button,
"clicked",
1147 button = gtk_button_new();
1149 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
1150 gtk_grid_attach(GTK_GRID(table2), button, 0, 2, 1, 1);
1152 arrow = gtk_arrow_new(GTK_ARROW_DOWN, GTK_SHADOW_IN);
1153 gtk_container_add(GTK_CONTAINER(button), arrow);
1154 g_signal_connect_swapped(button,
"clicked",
1158 button = gtk_button_new();
1159 gtk_widget_set_margin_top(button, 24);
1160 gtk_widget_set_margin_bottom(button, 24);
1162 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
1163 gtk_grid_attach(GTK_GRID(table2), button, 0, 3, 1, 1);
1165 arrow = gtk_arrow_new(GTK_ARROW_LEFT, GTK_SHADOW_NONE);
1166 gtk_container_add(GTK_CONTAINER(button), arrow);
1167 g_signal_connect_swapped(button,
"clicked",
1171 button = gtk_button_new();
1172 gtk_widget_set_margin_top(button, 24);
1173 gtk_widget_set_margin_bottom(button, 24);
1175 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
1176 gtk_grid_attach(GTK_GRID(table2), button, 0, 4, 1, 1);
1178 arrow = gtk_arrow_new(GTK_ARROW_RIGHT, GTK_SHADOW_IN);
1179 gtk_container_add(GTK_CONTAINER(button), arrow);
1180 g_signal_connect_swapped(button,
"clicked",
1184 sw = gtk_scrolled_window_new(NULL, NULL);
1185 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw),
1186 GTK_SHADOW_ETCHED_IN);
1187 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
1188 GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
1189 gtk_grid_attach(GTK_GRID(table), sw, 0, 1, 2, 1);
1191 dst_view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(dst_store));
1194 g_object_unref(dst_store);
1196 gtk_widget_set_name(
dst_view,
"small_font");
1197 gtk_tree_view_set_tooltip_column(GTK_TREE_VIEW(
dst_view), 1);
1200 gtk_container_add(GTK_CONTAINER(sw),
dst_view);
1202 label = g_object_new(GTK_TYPE_LABEL,
1203 "use-underline",
TRUE,
1205 "label",
_(
"Target _Worklist:"),
1206 "xalign", 0.0,
"yalign", 0.5, NULL);
1207 gtk_grid_attach(GTK_GRID(table), label, 0, 0, 1, 1);
1210 bbox = gtk_button_box_new(GTK_ORIENTATION_HORIZONTAL);
1211 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END);
1212 gtk_box_set_spacing(GTK_BOX(bbox), 10);
1213 gtk_container_add(GTK_CONTAINER(
editor), bbox);
1216 gtk_container_add(GTK_CONTAINER(bbox), menubar);
1217 gtk_button_box_set_child_secondary(GTK_BUTTON_BOX(bbox), menubar,
TRUE);
1219 menu = gtk_menu_new();
1221 image = gtk_image_new_from_stock(GTK_STOCK_ADD, GTK_ICON_SIZE_MENU);
1222 item = gtk_image_menu_item_new_with_mnemonic(
_(
"_Add Global Worklist"));
1223 gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(
item), image);
1224 gtk_menu_item_set_submenu(GTK_MENU_ITEM(
item),
menu);
1225 gtk_menu_shell_append(GTK_MENU_SHELL(menubar),
item);
1226 g_signal_connect(
menu,
"show",
1231 button = gtk_button_new_from_stock(GTK_STOCK_HELP);
1232 gtk_container_add(GTK_CONTAINER(bbox), button);
1233 g_signal_connect(button,
"clicked",
1238 button = gtk_button_new_with_mnemonic(
_(
"Change Prod_uction"));
1239 gtk_container_add(GTK_CONTAINER(bbox), button);
1240 g_signal_connect(button,
"clicked",
1249 gtk_tree_selection_set_mode(ptr->
dst_selection, GTK_SELECTION_MULTIPLE);
1252 gtk_tree_view_set_reorderable(GTK_TREE_VIEW(
dst_view),
TRUE);
1253 g_signal_connect(
dst_view,
"drag_end",
1256 g_signal_connect(
src_view,
"row_activated",
1258 g_signal_connect(
src_view,
"key_press_event",
1261 g_signal_connect(
dst_view,
"row_activated",
1263 g_signal_connect(
dst_view,
"key_press_event",
1272 gtk_widget_show_all(table);
1273 gtk_widget_show_all(bbox);
1334 int i, targets_used;
1340 GtkTreeModel *model;
1343 ptr = g_object_get_data(G_OBJECT(
editor),
"data");
1346 if (gtk_tree_selection_get_selected(ptr->
src_selection, NULL, &it)) {
1347 gtk_tree_model_get(GTK_TREE_MODEL(ptr->
src), &it, 0, &
id, -1);
1362 model = GTK_TREE_MODEL(ptr->
src);
1363 exists = gtk_tree_model_get_iter_first(model, &it);
1366 for (i = 0; i < targets_used; i++) {
1370 gtk_list_store_append(ptr->
src, &it);
1375 buf,
sizeof(buf)), -1);
1378 path = gtk_tree_model_get_path(GTK_TREE_MODEL(ptr->
src), &it);
1382 exists = gtk_tree_model_iter_next(model, &it);
1388 GtkTreeIter it_next;
1393 more = gtk_tree_model_iter_next(model, &it_next);
1395 gtk_list_store_remove(ptr->
src, &it);
1402 gtk_tree_view_set_cursor(GTK_TREE_VIEW(ptr->
src_view), path, NULL,
FALSE);
1403 gtk_tree_path_free(path);
1407 model = GTK_TREE_MODEL(ptr->
dst);
1408 exists = gtk_tree_model_get_iter_first(model, &it);
1411 if (ptr->
pcity != NULL) {
1428 gtk_list_store_append(ptr->
dst, &it);
1431 gtk_list_store_set(ptr->
dst, &it, 0, (gint)
cid_encode(target),
1433 buf,
sizeof(buf)), -1);
1436 exists = gtk_tree_model_iter_next(model, &it);
1441 GtkTreeIter it_next;
1446 more = gtk_tree_model_iter_next(model, &it_next);
1448 gtk_list_store_remove(ptr->
dst, &it);