[dia/dia-next: 14/59] Port UML editors
- From: Zander <zbrown src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dia/dia-next: 14/59] Port UML editors
- Date: Wed, 9 Jan 2019 18:35:28 +0000 (UTC)
commit 1caab22653fdfc7a3191476cd2bd0854385764fc
Author: Zander Brown <zbrown gnome org>
Date: Sun Dec 23 18:58:00 2018 +0000
Port UML editors
Uses DiaList instead of GtkList as a temporary measure
Strongly suspect this is broken
objects/UML/class_attributes_dialog.c | 89 +++++++++----------
objects/UML/class_dialog.c | 34 +++----
objects/UML/class_dialog.h | 19 ++--
objects/UML/class_operations_dialog.c | 163 +++++++++++++++++-----------------
objects/UML/class_templates_dialog.c | 82 +++++++++--------
5 files changed, 192 insertions(+), 195 deletions(-)
---
diff --git a/objects/UML/class_attributes_dialog.c b/objects/UML/class_attributes_dialog.c
index 39fd041d..38cc478c 100644
--- a/objects/UML/class_attributes_dialog.c
+++ b/objects/UML/class_attributes_dialog.c
@@ -19,7 +19,6 @@
#include <config.h>
#include <assert.h>
-#undef GTK_DISABLE_DEPRECATED /* GtkList, ... */
#include <gtk/gtk.h>
#include "class.h"
@@ -88,7 +87,7 @@ attributes_get_values (UMLClassDialog *prop_dialog, UMLAttribute *attr)
attr->visibility = (UMLVisibility)dia_option_menu_get_active (prop_dialog->attr_visible);
- attr->class_scope = prop_dialog->attr_class_scope->active;
+ attr->class_scope = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (prop_dialog->attr_class_scope));
}
void
@@ -129,9 +128,8 @@ static void
attributes_list_selection_changed_callback(GtkWidget *gtklist,
UMLClass *umlclass)
{
- GList *list;
+ DiaListItem *list;
UMLClassDialog *prop_dialog;
- GObject *list_item;
UMLAttribute *attr;
/* Due to GtkList oddities, this may get called during destroy.
@@ -149,7 +147,7 @@ attributes_list_selection_changed_callback(GtkWidget *gtklist,
_attributes_get_current_values(prop_dialog);
- list = GTK_LIST(gtklist)->selection;
+ list = dia_list_get_selection (DIA_LIST (gtklist));
if (!list && prop_dialog) { /* No selected */
attributes_set_sensitive(prop_dialog, FALSE);
attributes_clear_values(prop_dialog);
@@ -157,12 +155,11 @@ attributes_list_selection_changed_callback(GtkWidget *gtklist,
return;
}
- list_item = G_OBJECT(list->data);
- attr = (UMLAttribute *)g_object_get_data(G_OBJECT(list_item), "user_data");
+ attr = (UMLAttribute *)g_object_get_data (G_OBJECT (list), "user_data");
attributes_set_values(prop_dialog, attr);
attributes_set_sensitive(prop_dialog, TRUE);
- prop_dialog->current_attr = GTK_LIST_ITEM(list_item);
+ prop_dialog->current_attr = DIA_LIST_ITEM (list);
gtk_widget_grab_focus(GTK_WIDGET(prop_dialog->attr_name));
}
@@ -188,7 +185,7 @@ attributes_list_new_callback(GtkWidget *button,
g_list_prepend(prop_dialog->added_connections, attr->right_connection);
utfstr = uml_get_attribute_string (attr);
- list_item = gtk_list_item_new_with_label (utfstr);
+ list_item = dia_list_item_new_with_label (utfstr);
gtk_widget_show (list_item);
g_free (utfstr);
@@ -197,12 +194,12 @@ attributes_list_new_callback(GtkWidget *button,
G_CALLBACK (attribute_list_item_destroy_callback), NULL);
list = g_list_append(NULL, list_item);
- gtk_list_append_items(prop_dialog->attributes_list, list);
+ dia_list_append_items(prop_dialog->attributes_list, list);
- if (prop_dialog->attributes_list->children != NULL)
- gtk_list_unselect_child(prop_dialog->attributes_list,
- GTK_WIDGET(prop_dialog->attributes_list->children->data));
- gtk_list_select_child(prop_dialog->attributes_list, list_item);
+ if (dia_list_get_children (prop_dialog->attributes_list) != NULL)
+ dia_list_unselect_child(prop_dialog->attributes_list,
+ GTK_WIDGET(dia_list_get_children (prop_dialog->attributes_list)->data));
+ dia_list_select_child(prop_dialog->attributes_list, list_item);
}
static void
@@ -211,15 +208,15 @@ attributes_list_delete_callback(GtkWidget *button,
{
GList *list;
UMLClassDialog *prop_dialog;
- GtkList *gtklist;
+ DiaList *gtklist;
UMLAttribute *attr;
prop_dialog = umlclass->properties_dialog;
- gtklist = GTK_LIST(prop_dialog->attributes_list);
+ gtklist = DIA_LIST (prop_dialog->attributes_list);
- if (gtklist->selection != NULL) {
+ if (dia_list_get_selection (gtklist) != NULL) {
attr = (UMLAttribute *)
- g_object_get_data(G_OBJECT(gtklist->selection->data), "user_data");
+ g_object_get_data(G_OBJECT(dia_list_get_selection (gtklist)), "user_data");
if (attr->left_connection != NULL) {
prop_dialog->deleted_connections =
@@ -230,8 +227,8 @@ attributes_list_delete_callback(GtkWidget *button,
attr->right_connection);
}
- list = g_list_prepend(NULL, gtklist->selection->data);
- gtk_list_remove_items(gtklist, list);
+ list = g_list_prepend(NULL, dia_list_get_selection (gtklist));
+ dia_list_remove_items(gtklist, list);
g_list_free(list);
attributes_clear_values(prop_dialog);
attributes_set_sensitive(prop_dialog, FALSE);
@@ -244,27 +241,27 @@ attributes_list_move_up_callback(GtkWidget *button,
{
GList *list;
UMLClassDialog *prop_dialog;
- GtkList *gtklist;
+ DiaList *gtklist;
GtkWidget *list_item;
int i;
prop_dialog = umlclass->properties_dialog;
- gtklist = GTK_LIST(prop_dialog->attributes_list);
+ gtklist = prop_dialog->attributes_list;
- if (gtklist->selection != NULL) {
- list_item = GTK_WIDGET(gtklist->selection->data);
+ if (dia_list_get_selection (gtklist) != NULL) {
+ list_item = GTK_WIDGET (dia_list_get_selection (gtklist));
- i = gtk_list_child_position(gtklist, list_item);
+ i = dia_list_child_position (gtklist, list_item);
if (i>0)
i--;
g_object_ref(list_item);
list = g_list_prepend(NULL, list_item);
- gtk_list_remove_items(gtklist, list);
- gtk_list_insert_items(gtklist, list, i);
+ dia_list_remove_items (gtklist, list);
+ dia_list_insert_items (gtklist, list, i);
g_object_unref(list_item);
- gtk_list_select_child(gtklist, list_item);
+ dia_list_select_child(gtklist, list_item);
}
}
@@ -274,28 +271,28 @@ attributes_list_move_down_callback(GtkWidget *button,
{
GList *list;
UMLClassDialog *prop_dialog;
- GtkList *gtklist;
+ DiaList *gtklist;
GtkWidget *list_item;
int i;
prop_dialog = umlclass->properties_dialog;
- gtklist = GTK_LIST(prop_dialog->attributes_list);
+ gtklist = prop_dialog->attributes_list;
- if (gtklist->selection != NULL) {
- list_item = GTK_WIDGET(gtklist->selection->data);
+ if (dia_list_get_selection (gtklist) != NULL) {
+ list_item = GTK_WIDGET(dia_list_get_selection (gtklist));
- i = gtk_list_child_position(gtklist, list_item);
- if (i<(g_list_length(gtklist->children)-1))
+ i = dia_list_child_position (gtklist, list_item);
+ if (i<(g_list_length (dia_list_get_children (gtklist))-1))
i++;
g_object_ref(list_item);
list = g_list_prepend(NULL, list_item);
- gtk_list_remove_items(gtklist, list);
- gtk_list_insert_items(gtklist, list, i);
+ dia_list_remove_items(gtklist, list);
+ dia_list_insert_items(gtklist, list, i);
g_object_unref(list_item);
- gtk_list_select_child(gtklist, list_item);
+ dia_list_select_child(gtklist, list_item);
}
}
@@ -326,7 +323,7 @@ _attributes_read_from_dialog(UMLClass *umlclass,
umlclass->attributes = NULL;
/* Insert new attributes and remove them from gtklist: */
- list = GTK_LIST (prop_dialog->attributes_list)->children;
+ list = dia_list_get_children (prop_dialog->attributes_list);
clear_list = NULL;
while (list != NULL) {
list_item = GTK_WIDGET(list->data);
@@ -348,8 +345,8 @@ _attributes_read_from_dialog(UMLClass *umlclass,
attr->right_connection);
}
- if ( (prop_dialog->attr_vis->active) &&
- (!prop_dialog->attr_supp->active) ) {
+ if ( (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (prop_dialog->attr_vis))) &&
+ (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (prop_dialog->attr_supp))) ) {
obj->connections[connection_index] = attr->left_connection;
connection_index++;
obj->connections[connection_index] = attr->right_connection;
@@ -364,7 +361,7 @@ _attributes_read_from_dialog(UMLClass *umlclass,
list = g_list_next(list);
}
clear_list = g_list_reverse (clear_list);
- gtk_list_remove_items (GTK_LIST (prop_dialog->attributes_list), clear_list);
+ dia_list_remove_items (DIA_LIST (prop_dialog->attributes_list), clear_list);
g_list_free (clear_list);
#if 0 /* UMLClass is *known* to be in an incositent state here, check later or crash ... */
@@ -388,14 +385,14 @@ _attributes_fill_in_dialog(UMLClass *umlclass)
prop_dialog = umlclass->properties_dialog;
/* copy in new attributes: */
- if (prop_dialog->attributes_list->children == NULL) {
+ if (dia_list_get_children (prop_dialog->attributes_list) == NULL) {
i = 0;
list = umlclass->attributes;
while (list != NULL) {
UMLAttribute *attr = (UMLAttribute *)list->data;
gchar *attrstr = uml_get_attribute_string(attr);
- list_item = gtk_list_item_new_with_label (attrstr);
+ list_item = dia_list_item_new_with_label (attrstr);
attr_copy = uml_attribute_copy(attr);
/* looks wrong but required for complicated ConnectionPoint memory management */
attr_copy->left_connection = attr->left_connection;
@@ -466,9 +463,9 @@ _attributes_create_page(GtkNotebook *notebook, UMLClass *umlclass)
gtk_box_pack_start (GTK_BOX (hbox), scrolled_win, TRUE, TRUE, 0);
gtk_widget_show (scrolled_win);
- list = gtk_list_new ();
- prop_dialog->attributes_list = GTK_LIST(list);
- gtk_list_set_selection_mode (GTK_LIST (list), GTK_SELECTION_SINGLE);
+ list = dia_list_new ();
+ prop_dialog->attributes_list = DIA_LIST(list);
+ dia_list_set_selection_mode (DIA_LIST (list), GTK_SELECTION_SINGLE);
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_win), list);
gtk_container_set_focus_vadjustment (GTK_CONTAINER (list),
gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW
(scrolled_win)));
diff --git a/objects/UML/class_dialog.c b/objects/UML/class_dialog.c
index c4048b45..bc1d1c49 100644
--- a/objects/UML/class_dialog.c
+++ b/objects/UML/class_dialog.c
@@ -32,7 +32,6 @@
#include <config.h>
#include <assert.h>
-#undef GTK_DISABLE_DEPRECATED /* GtkList, ... */
#include <gtk/gtk.h>
#include <math.h>
#include <string.h>
@@ -197,16 +196,16 @@ class_read_from_dialog(UMLClass *umlclass, UMLClassDialog *prop_dialog)
else
umlclass->comment = NULL;
- umlclass->abstract = prop_dialog->abstract_class->active;
- umlclass->visible_attributes = prop_dialog->attr_vis->active;
- umlclass->visible_operations = prop_dialog->op_vis->active;
- umlclass->wrap_operations = prop_dialog->op_wrap->active;
+ umlclass->abstract = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (prop_dialog->abstract_class));
+ umlclass->visible_attributes = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (prop_dialog->attr_vis));
+ umlclass->visible_operations = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (prop_dialog->op_vis));
+ umlclass->wrap_operations = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (prop_dialog->op_wrap));
umlclass->wrap_after_char = gtk_spin_button_get_value_as_int(prop_dialog->wrap_after_char);
umlclass->comment_line_length = gtk_spin_button_get_value_as_int(prop_dialog->comment_line_length);
- umlclass->comment_tagging = prop_dialog->comment_tagging->active;
- umlclass->visible_comments = prop_dialog->comments_vis->active;
- umlclass->suppress_attributes = prop_dialog->attr_supp->active;
- umlclass->suppress_operations = prop_dialog->op_supp->active;
+ umlclass->comment_tagging = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON
(prop_dialog->comment_tagging));
+ umlclass->visible_comments = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (prop_dialog->comments_vis));
+ umlclass->suppress_attributes = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (prop_dialog->attr_supp));
+ umlclass->suppress_operations = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (prop_dialog->op_supp));
umlclass->line_width = gtk_spin_button_get_value(prop_dialog->line_width);
dia_color_selector_get_color(GTK_WIDGET(prop_dialog->text_color), ¨class->text_color);
dia_color_selector_get_color(GTK_WIDGET(prop_dialog->line_color), ¨class->line_color);
@@ -287,7 +286,8 @@ create_font_props_row (GtkTable *table,
GObject *adj;
label = gtk_label_new (kind);
- gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+ gtk_label_set_xalign (GTK_LABEL (label), 0.0);
+ gtk_label_set_yalign (GTK_LABEL (label), 0.5);
gtk_table_attach_defaults (table, label, 0, 1, row, row+1);
*fontsel = DIA_FONT_SELECTOR (dia_font_selector_new ());
dia_font_selector_set_font (DIA_FONT_SELECTOR (*fontsel), font);
@@ -542,7 +542,7 @@ style_create_page(GtkNotebook *notebook, UMLClass *umlclass)
static void
switch_page_callback(GtkNotebook *notebook,
- GtkNotebookPage *page)
+ GtkWidget *page)
{
UMLClass *umlclass;
UMLClassDialog *prop_dialog;
@@ -602,12 +602,12 @@ umlclass_apply_props_from_dialog(UMLClass *umlclass, GtkWidget *widget)
/* Allocate enought connection points for attributes and operations. */
/* (two per op/attr) */
- if ( (prop_dialog->attr_vis->active) && (!prop_dialog->attr_supp->active))
- num_attrib = g_list_length(prop_dialog->attributes_list->children);
+ if ( (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (prop_dialog->attr_vis))) &&
(!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (prop_dialog->attr_supp))))
+ num_attrib = g_list_length(dia_list_get_children(prop_dialog->attributes_list));
else
num_attrib = 0;
- if ( (prop_dialog->op_vis->active) && (!prop_dialog->op_supp->active))
- num_ops = g_list_length(prop_dialog->operations_list->children);
+ if ( (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (prop_dialog->op_vis))) &&
(!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (prop_dialog->op_supp))))
+ num_ops = g_list_length(dia_list_get_children(prop_dialog->operations_list));
else
num_ops = 0;
obj = ¨class->element.object;
@@ -905,7 +905,7 @@ umlclass_update_connectionpoints(UMLClass *umlclass)
}
if (prop_dialog)
- gtk_list_clear_items (GTK_LIST (prop_dialog->attributes_list), 0, -1);
+ dia_list_empty (DIA_LIST (prop_dialog->attributes_list));
list = umlclass->operations;
while (list != NULL) {
@@ -922,7 +922,7 @@ umlclass_update_connectionpoints(UMLClass *umlclass)
list = g_list_next(list);
}
if (prop_dialog)
- gtk_list_clear_items (GTK_LIST (prop_dialog->operations_list), 0, -1);
+ dia_list_empty (DIA_LIST (prop_dialog->operations_list));
#ifdef UML_MAINPOINT
obj->connections[connection_index++] = ¨class->connections[UMLCLASS_CONNECTIONPOINTS];
diff --git a/objects/UML/class_dialog.h b/objects/UML/class_dialog.h
index 919d0b52..f3c538b5 100644
--- a/objects/UML/class_dialog.h
+++ b/objects/UML/class_dialog.h
@@ -1,4 +1,7 @@
#include "widgets.h"
+#include "widgets/dialist.h"
+#include "diafontselector.h"
+
/**
* \brief Very special user interface for UMLClass parametrization
*
@@ -45,8 +48,8 @@ struct _UMLClassDialog {
GList *added_connections;
GList *deleted_connections;
- GtkList *attributes_list;
- GtkListItem *current_attr;
+ DiaList *attributes_list;
+ DiaListItem *current_attr;
GtkEntry *attr_name;
GtkEntry *attr_type;
GtkEntry *attr_value;
@@ -54,8 +57,8 @@ struct _UMLClassDialog {
GtkWidget *attr_visible;
GtkToggleButton *attr_class_scope;
- GtkList *operations_list;
- GtkListItem *current_op;
+ DiaList *operations_list;
+ DiaListItem *current_op;
GtkEntry *op_name;
GtkEntry *op_type;
GtkEntry *op_stereotype;
@@ -66,8 +69,8 @@ struct _UMLClassDialog {
GtkWidget *op_inheritance_type;
GtkToggleButton *op_query;
- GtkList *parameters_list;
- GtkListItem *current_param;
+ DiaList *parameters_list;
+ DiaListItem *current_param;
GtkEntry *param_name;
GtkEntry *param_type;
GtkEntry *param_value;
@@ -78,8 +81,8 @@ struct _UMLClassDialog {
GtkWidget *param_up_button;
GtkWidget *param_down_button;
- GtkList *templates_list;
- GtkListItem *current_templ;
+ DiaList *templates_list;
+ DiaListItem *current_templ;
GtkToggleButton *templ_template;
GtkEntry *templ_name;
GtkEntry *templ_type;
diff --git a/objects/UML/class_operations_dialog.c b/objects/UML/class_operations_dialog.c
index ebce55a5..f8cfebb5 100644
--- a/objects/UML/class_operations_dialog.c
+++ b/objects/UML/class_operations_dialog.c
@@ -19,7 +19,6 @@
#include <config.h>
#include <assert.h>
-#undef GTK_DISABLE_DEPRECATED /* GtkList, ... */
#include <gtk/gtk.h>
#include "class.h"
@@ -124,7 +123,7 @@ parameters_list_selection_changed_callback(GtkWidget *gtklist,
parameters_get_current_values(prop_dialog);
- list = GTK_LIST(gtklist)->selection;
+ list = dia_list_get_selection (DIA_LIST (gtklist));
if (!list) { /* No selected */
parameters_set_sensitive(prop_dialog, FALSE);
parameters_clear_values(prop_dialog);
@@ -137,7 +136,7 @@ parameters_list_selection_changed_callback(GtkWidget *gtklist,
parameters_set_values(prop_dialog, param);
parameters_set_sensitive(prop_dialog, TRUE);
- prop_dialog->current_param = GTK_LIST_ITEM(list_item);
+ prop_dialog->current_param = DIA_LIST_ITEM(list_item);
gtk_widget_grab_focus(GTK_WIDGET(prop_dialog->param_name));
}
@@ -162,7 +161,7 @@ parameters_list_new_callback(GtkWidget *button,
param = uml_parameter_new();
utf = uml_get_parameter_string (param);
- list_item = gtk_list_item_new_with_label (utf);
+ list_item = dia_list_item_new_with_label (utf);
gtk_widget_show (list_item);
g_free (utf);
@@ -172,14 +171,14 @@ parameters_list_new_callback(GtkWidget *button,
(gpointer) param);
list = g_list_append(NULL, list_item);
- gtk_list_append_items(prop_dialog->parameters_list, list);
+ dia_list_append_items(prop_dialog->parameters_list, list);
- if (prop_dialog->parameters_list->children != NULL)
- gtk_list_unselect_child(prop_dialog->parameters_list,
- GTK_WIDGET(prop_dialog->parameters_list->children->data));
- gtk_list_select_child(prop_dialog->parameters_list, list_item);
+ if (dia_list_get_children (DIA_LIST (prop_dialog->parameters_list)) != NULL)
+ dia_list_unselect_child(prop_dialog->parameters_list,
+ GTK_WIDGET(dia_list_get_children (DIA_LIST
(prop_dialog->parameters_list))->data));
+ dia_list_select_child(prop_dialog->parameters_list, list_item);
- prop_dialog->current_param = GTK_LIST_ITEM(list_item);
+ prop_dialog->current_param = DIA_LIST_ITEM(list_item);
}
static void
@@ -188,15 +187,15 @@ parameters_list_delete_callback(GtkWidget *button,
{
GList *list;
UMLClassDialog *prop_dialog;
- GtkList *gtklist;
+ DiaList *gtklist;
UMLOperation *current_op;
UMLParameter *param;
prop_dialog = umlclass->properties_dialog;
- gtklist = GTK_LIST(prop_dialog->parameters_list);
+ gtklist = DIA_LIST(prop_dialog->parameters_list);
- if (gtklist->selection != NULL) {
+ if (dia_list_get_selection (DIA_LIST (gtklist)) != NULL) {
/* Remove from current operations parameter list: */
current_op = (UMLOperation *)
g_object_get_data(G_OBJECT(prop_dialog->current_op), "user_data");
@@ -212,7 +211,7 @@ parameters_list_delete_callback(GtkWidget *button,
prop_dialog->current_param = NULL;
- gtk_list_remove_items(gtklist, list);
+ dia_list_remove_items(gtklist, list);
g_list_free(list);
}
}
@@ -223,19 +222,19 @@ parameters_list_move_up_callback(GtkWidget *button,
{
GList *list;
UMLClassDialog *prop_dialog;
- GtkList *gtklist;
- GtkWidget *list_item;
+ DiaList *gtklist;
+ DiaListItem *list_item;
UMLOperation *current_op;
UMLParameter *param;
int i;
prop_dialog = umlclass->properties_dialog;
- gtklist = GTK_LIST(prop_dialog->parameters_list);
+ gtklist = DIA_LIST(prop_dialog->parameters_list);
- if (gtklist->selection != NULL) {
- list_item = GTK_WIDGET(gtklist->selection->data);
+ if (dia_list_get_selection (DIA_LIST (gtklist)) != NULL) {
+ list_item = dia_list_get_selection (DIA_LIST (gtklist));
- i = gtk_list_child_position(gtklist, list_item);
+ i = dia_list_child_position(gtklist, list_item);
if (i>0)
i--;
@@ -254,11 +253,11 @@ parameters_list_move_up_callback(GtkWidget *button,
/* Move parameter in gtk list: */
g_object_ref(list_item);
list = g_list_prepend(NULL, list_item);
- gtk_list_remove_items(gtklist, list);
- gtk_list_insert_items(gtklist, list, i);
+ dia_list_remove_items(gtklist, list);
+ dia_list_insert_items(gtklist, list, i);
g_object_unref(list_item);
- gtk_list_select_child(gtklist, list_item);
+ dia_list_select_child(gtklist, list_item);
_operations_get_current_values(prop_dialog);
}
@@ -270,20 +269,20 @@ parameters_list_move_down_callback(GtkWidget *button,
{
GList *list;
UMLClassDialog *prop_dialog;
- GtkList *gtklist;
- GtkWidget *list_item;
+ DiaList *gtklist;
+ DiaListItem *list_item;
UMLOperation *current_op;
UMLParameter *param;
int i;
prop_dialog = umlclass->properties_dialog;
- gtklist = GTK_LIST(prop_dialog->parameters_list);
+ gtklist = DIA_LIST(prop_dialog->parameters_list);
- if (gtklist->selection != NULL) {
- list_item = GTK_WIDGET(gtklist->selection->data);
+ if (dia_list_get_selection (DIA_LIST (gtklist)) != NULL) {
+ list_item = dia_list_get_selection (DIA_LIST (gtklist));
- i = gtk_list_child_position(gtklist, list_item);
- if (i<(g_list_length(gtklist->children)-1))
+ i = dia_list_child_position(gtklist, list_item);
+ if (i<(g_list_length(dia_list_get_children (DIA_LIST (gtklist)))-1))
i++;
param = (UMLParameter *) g_object_get_data(G_OBJECT(list_item), "user_data");
@@ -301,11 +300,11 @@ parameters_list_move_down_callback(GtkWidget *button,
/* Move parameter in gtk list: */
g_object_ref(list_item);
list = g_list_prepend(NULL, list_item);
- gtk_list_remove_items(gtklist, list);
- gtk_list_insert_items(gtklist, list, i);
+ dia_list_remove_items(gtklist, list);
+ dia_list_insert_items(gtklist, list, i);
g_object_unref(list_item);
- gtk_list_select_child(gtklist, list_item);
+ dia_list_select_child(gtklist, list_item);
_operations_get_current_values(prop_dialog);
}
@@ -358,7 +357,7 @@ operations_set_values(UMLClassDialog *prop_dialog, UMLOperation *op)
gtk_toggle_button_set_active(prop_dialog->op_query, op->query);
dia_option_menu_set_active(prop_dialog->op_inheritance_type, op->inheritance_type);
- gtk_list_clear_items(prop_dialog->parameters_list, 0, -1);
+ dia_list_empty (prop_dialog->parameters_list);
prop_dialog->current_param = NULL;
parameters_set_sensitive(prop_dialog, FALSE);
@@ -367,7 +366,7 @@ operations_set_values(UMLClassDialog *prop_dialog, UMLOperation *op)
param = (UMLParameter *)list->data;
str = uml_get_parameter_string (param);
- list_item = gtk_list_item_new_with_label (str);
+ list_item = dia_list_item_new_with_label (str);
g_free (str);
g_object_set_data(G_OBJECT(list_item), "user_data", (gpointer) param);
@@ -388,7 +387,7 @@ operations_clear_values(UMLClassDialog *prop_dialog)
gtk_toggle_button_set_active(prop_dialog->op_class_scope, FALSE);
gtk_toggle_button_set_active(prop_dialog->op_query, FALSE);
- gtk_list_clear_items(prop_dialog->parameters_list, 0, -1);
+ dia_list_empty (prop_dialog->parameters_list);
prop_dialog->current_param = NULL;
parameters_set_sensitive(prop_dialog, FALSE);
}
@@ -415,10 +414,10 @@ operations_get_values(UMLClassDialog *prop_dialog, UMLOperation *op)
op->visibility = (UMLVisibility)dia_option_menu_get_active(prop_dialog->op_visible);
- op->class_scope = prop_dialog->op_class_scope->active;
+ op->class_scope = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (prop_dialog->op_class_scope));
op->inheritance_type = (UMLInheritanceType)dia_option_menu_get_active(prop_dialog->op_inheritance_type);
- op->query = prop_dialog->op_query->active;
+ op->query = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (prop_dialog->op_query));
}
@@ -474,7 +473,7 @@ operations_list_selection_changed_callback(GtkWidget *gtklist,
_operations_get_current_values(prop_dialog);
- list = GTK_LIST(gtklist)->selection;
+ list = dia_list_get_selection (DIA_LIST (gtklist));
if (!list) { /* No selected */
operations_set_sensitive(prop_dialog, FALSE);
operations_clear_values(prop_dialog);
@@ -487,7 +486,7 @@ operations_list_selection_changed_callback(GtkWidget *gtklist,
operations_set_values(prop_dialog, op);
operations_set_sensitive(prop_dialog, TRUE);
- prop_dialog->current_op = GTK_LIST_ITEM(list_item);
+ prop_dialog->current_op = DIA_LIST_ITEM(list_item);
gtk_widget_grab_focus(GTK_WIDGET(prop_dialog->op_name));
}
@@ -515,7 +514,7 @@ operations_list_new_callback(GtkWidget *button,
utfstr = uml_get_operation_string (op);
- list_item = gtk_list_item_new_with_label (utfstr);
+ list_item = dia_list_item_new_with_label (utfstr);
gtk_widget_show (list_item);
g_free (utfstr);
@@ -524,12 +523,12 @@ operations_list_new_callback(GtkWidget *button,
G_CALLBACK (operations_list_item_destroy_callback), NULL);
list = g_list_append(NULL, list_item);
- gtk_list_append_items(prop_dialog->operations_list, list);
+ dia_list_append_items(prop_dialog->operations_list, list);
- if (prop_dialog->operations_list->children != NULL)
- gtk_list_unselect_child(prop_dialog->operations_list,
- GTK_WIDGET(prop_dialog->operations_list->children->data));
- gtk_list_select_child(prop_dialog->operations_list, list_item);
+ if (dia_list_get_children (DIA_LIST (prop_dialog->operations_list)) != NULL)
+ dia_list_unselect_child(prop_dialog->operations_list,
+ GTK_WIDGET(dia_list_get_children (DIA_LIST
(prop_dialog->operations_list))->data));
+ dia_list_select_child(prop_dialog->operations_list, list_item);
}
static void
@@ -538,16 +537,16 @@ operations_list_delete_callback(GtkWidget *button,
{
GList *list;
UMLClassDialog *prop_dialog;
- GtkList *gtklist;
+ DiaList *gtklist;
UMLOperation *op;
prop_dialog = umlclass->properties_dialog;
- gtklist = GTK_LIST(prop_dialog->operations_list);
+ gtklist = DIA_LIST(prop_dialog->operations_list);
- if (gtklist->selection != NULL) {
+ if (dia_list_get_selection (DIA_LIST (gtklist)) != NULL) {
op = (UMLOperation *)
- g_object_get_data(G_OBJECT(gtklist->selection->data), "user_data");
+ g_object_get_data (G_OBJECT (dia_list_get_selection (DIA_LIST (gtklist))), "user_data");
if (op->left_connection != NULL) {
prop_dialog->deleted_connections =
@@ -558,8 +557,8 @@ operations_list_delete_callback(GtkWidget *button,
op->right_connection);
}
- list = g_list_prepend(NULL, gtklist->selection->data);
- gtk_list_remove_items(gtklist, list);
+ list = g_list_prepend(NULL, dia_list_get_selection (DIA_LIST (gtklist)));
+ dia_list_remove_items(gtklist, list);
g_list_free(list);
operations_clear_values(prop_dialog);
operations_set_sensitive(prop_dialog, FALSE);
@@ -572,27 +571,27 @@ operations_list_move_up_callback(GtkWidget *button,
{
GList *list;
UMLClassDialog *prop_dialog;
- GtkList *gtklist;
+ DiaList *gtklist;
GtkWidget *list_item;
int i;
prop_dialog = umlclass->properties_dialog;
- gtklist = GTK_LIST(prop_dialog->operations_list);
+ gtklist = DIA_LIST(prop_dialog->operations_list);
- if (gtklist->selection != NULL) {
- list_item = GTK_WIDGET(gtklist->selection->data);
+ if (dia_list_get_selection (DIA_LIST (gtklist)) != NULL) {
+ list_item = GTK_WIDGET (dia_list_get_selection (DIA_LIST (gtklist)));
- i = gtk_list_child_position(gtklist, list_item);
+ i = dia_list_child_position(gtklist, list_item);
if (i>0)
i--;
g_object_ref(list_item);
list = g_list_prepend(NULL, list_item);
- gtk_list_remove_items(gtklist, list);
- gtk_list_insert_items(gtklist, list, i);
+ dia_list_remove_items(gtklist, list);
+ dia_list_insert_items(gtklist, list, i);
g_object_unref(list_item);
- gtk_list_select_child(gtklist, list_item);
+ dia_list_select_child(gtklist, list_item);
}
}
@@ -603,27 +602,27 @@ operations_list_move_down_callback(GtkWidget *button,
{
GList *list;
UMLClassDialog *prop_dialog;
- GtkList *gtklist;
- GtkWidget *list_item;
+ DiaList *gtklist;
+ DiaListItem *list_item;
int i;
prop_dialog = umlclass->properties_dialog;
- gtklist = GTK_LIST(prop_dialog->operations_list);
+ gtklist = DIA_LIST(prop_dialog->operations_list);
- if (gtklist->selection != NULL) {
- list_item = GTK_WIDGET(gtklist->selection->data);
+ if (dia_list_get_selection (DIA_LIST (gtklist)) != NULL) {
+ list_item = dia_list_get_selection (DIA_LIST (gtklist));
- i = gtk_list_child_position(gtklist, list_item);
- if (i<(g_list_length(gtklist->children)-1))
+ i = dia_list_child_position(gtklist, list_item);
+ if (i<(g_list_length(dia_list_get_children (DIA_LIST (gtklist)))-1))
i++;
g_object_ref(list_item);
list = g_list_prepend(NULL, list_item);
- gtk_list_remove_items(gtklist, list);
- gtk_list_insert_items(gtklist, list, i);
+ dia_list_remove_items(gtklist, list);
+ dia_list_insert_items(gtklist, list, i);
g_object_unref(list_item);
- gtk_list_select_child(gtklist, list_item);
+ dia_list_select_child(gtklist, list_item);
}
}
@@ -654,7 +653,7 @@ _operations_read_from_dialog(UMLClass *umlclass,
umlclass->operations = NULL;
/* Insert new operations and remove them from gtklist: */
- list = GTK_LIST (prop_dialog->operations_list)->children;
+ list =dia_list_get_children (DIA_LIST (prop_dialog->operations_list));
clear_list = NULL;
while (list != NULL) {
list_item = GTK_WIDGET(list->data);
@@ -676,8 +675,8 @@ _operations_read_from_dialog(UMLClass *umlclass,
op->right_connection);
}
- if ( (prop_dialog->op_vis->active) &&
- (!prop_dialog->op_supp->active) ) {
+ if ( (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (prop_dialog->op_vis))) &&
+ (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (prop_dialog->op_supp))) ) {
obj->connections[connection_index] = op->left_connection;
connection_index++;
obj->connections[connection_index] = op->right_connection;
@@ -692,7 +691,7 @@ _operations_read_from_dialog(UMLClass *umlclass,
list = g_list_next(list);
}
clear_list = g_list_reverse (clear_list);
- gtk_list_remove_items (GTK_LIST (prop_dialog->operations_list), clear_list);
+ dia_list_remove_items (DIA_LIST (prop_dialog->operations_list), clear_list);
g_list_free (clear_list);
}
@@ -707,14 +706,14 @@ _operations_fill_in_dialog(UMLClass *umlclass)
prop_dialog = umlclass->properties_dialog;
- if (prop_dialog->operations_list->children == NULL) {
+ if (dia_list_get_children (DIA_LIST (prop_dialog->operations_list)) == NULL) {
i = 0;
list = umlclass->operations;
while (list != NULL) {
UMLOperation *op = (UMLOperation *)list->data;
gchar *opstr = uml_get_operation_string (op);
- list_item = gtk_list_item_new_with_label (opstr);
+ list_item = dia_list_item_new_with_label (opstr);
op_copy = uml_operation_copy (op);
/* Looks wrong but is required for the complicate connections memory management */
op_copy->left_connection = op->left_connection;
@@ -900,9 +899,9 @@ operations_parameters_editor_create_vbox (UMLClass *umlclass)
gtk_box_pack_start (GTK_BOX (hbox2), scrolled_win, TRUE, TRUE, 0);
gtk_widget_show (scrolled_win);
- list = gtk_list_new ();
- prop_dialog->parameters_list = GTK_LIST(list);
- gtk_list_set_selection_mode (GTK_LIST (list), GTK_SELECTION_SINGLE);
+ list = dia_list_new ();
+ prop_dialog->parameters_list = DIA_LIST(list);
+ dia_list_set_selection_mode (DIA_LIST (list), GTK_SELECTION_SINGLE);
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_win), list);
gtk_container_set_focus_vadjustment (GTK_CONTAINER (list),
gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW
(scrolled_win)));
@@ -1080,9 +1079,9 @@ _operations_create_page(GtkNotebook *notebook, UMLClass *umlclass)
gtk_box_pack_start (GTK_BOX (hbox), scrolled_win, TRUE, TRUE, 0);
gtk_widget_show (scrolled_win);
- list = gtk_list_new ();
- prop_dialog->operations_list = GTK_LIST(list);
- gtk_list_set_selection_mode (GTK_LIST (list), GTK_SELECTION_SINGLE);
+ list = dia_list_new ();
+ prop_dialog->operations_list = DIA_LIST(list);
+ dia_list_set_selection_mode (DIA_LIST (list), GTK_SELECTION_SINGLE);
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_win), list);
gtk_container_set_focus_vadjustment (GTK_CONTAINER (list),
gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW
(scrolled_win)));
diff --git a/objects/UML/class_templates_dialog.c b/objects/UML/class_templates_dialog.c
index 285e5265..e2498015 100644
--- a/objects/UML/class_templates_dialog.c
+++ b/objects/UML/class_templates_dialog.c
@@ -19,7 +19,6 @@
#include <config.h>
#include <assert.h>
-#undef GTK_DISABLE_DEPRECATED /* GtkList, ... */
#include <gtk/gtk.h>
#include "class.h"
@@ -118,20 +117,19 @@ templates_list_selection_changed_callback(GtkWidget *gtklist,
_templates_get_current_values(prop_dialog);
- list = GTK_LIST(gtklist)->selection;
- if (!list) { /* No selected */
+ list_item = dia_list_get_selection (DIA_LIST(gtklist));
+ if (!list_item) { /* No selected */
templates_set_sensitive(prop_dialog, FALSE);
templates_clear_values(prop_dialog);
prop_dialog->current_templ = NULL;
return;
}
- list_item = G_OBJECT(list->data);
param = (UMLFormalParameter *)g_object_get_data(G_OBJECT(list_item), "user_data");
templates_set_values(prop_dialog, param);
templates_set_sensitive(prop_dialog, TRUE);
- prop_dialog->current_templ = GTK_LIST_ITEM(list_item);
+ prop_dialog->current_templ = DIA_LIST_ITEM(list_item);
gtk_widget_grab_focus(GTK_WIDGET(prop_dialog->templ_name));
}
@@ -152,7 +150,7 @@ templates_list_new_callback(GtkWidget *button,
param = uml_formalparameter_new();
utfstr = uml_get_formalparameter_string (param);
- list_item = gtk_list_item_new_with_label (utfstr);
+ list_item = dia_list_item_new_with_label (utfstr);
gtk_widget_show (list_item);
g_free (utfstr);
@@ -161,12 +159,12 @@ templates_list_new_callback(GtkWidget *button,
G_CALLBACK (templates_list_item_destroy_callback), NULL);
list = g_list_append(NULL, list_item);
- gtk_list_append_items(prop_dialog->templates_list, list);
+ dia_list_append_items(prop_dialog->templates_list, list);
- if (prop_dialog->templates_list->children != NULL)
- gtk_list_unselect_child(prop_dialog->templates_list,
- GTK_WIDGET(prop_dialog->templates_list->children->data));
- gtk_list_select_child(prop_dialog->templates_list, list_item);
+ if (dia_list_get_children (prop_dialog->templates_list) != NULL)
+ dia_list_unselect_child(prop_dialog->templates_list,
+ GTK_WIDGET(dia_list_get_children (prop_dialog->templates_list)->data));
+ dia_list_select_child(prop_dialog->templates_list, list_item);
}
static void
@@ -175,14 +173,14 @@ templates_list_delete_callback(GtkWidget *button,
{
GList *list;
UMLClassDialog *prop_dialog;
- GtkList *gtklist;
+ DiaList *gtklist;
prop_dialog = umlclass->properties_dialog;
- gtklist = GTK_LIST(prop_dialog->templates_list);
+ gtklist = DIA_LIST(prop_dialog->templates_list);
- if (gtklist->selection != NULL) {
- list = g_list_prepend(NULL, gtklist->selection->data);
- gtk_list_remove_items(gtklist, list);
+ if (dia_list_get_selection (gtklist) != NULL) {
+ list = g_list_prepend(NULL, dia_list_get_selection (gtklist));
+ dia_list_remove_items(gtklist, list);
g_list_free(list);
templates_clear_values(prop_dialog);
templates_set_sensitive(prop_dialog, FALSE);
@@ -195,27 +193,27 @@ templates_list_move_up_callback(GtkWidget *button,
{
GList *list;
UMLClassDialog *prop_dialog;
- GtkList *gtklist;
+ DiaList *gtklist;
GtkWidget *list_item;
int i;
prop_dialog = umlclass->properties_dialog;
- gtklist = GTK_LIST(prop_dialog->templates_list);
+ gtklist = DIA_LIST(prop_dialog->templates_list);
- if (gtklist->selection != NULL) {
- list_item = GTK_WIDGET(gtklist->selection->data);
+ if (dia_list_get_selection (gtklist) != NULL) {
+ list_item = GTK_WIDGET(dia_list_get_selection (gtklist));
- i = gtk_list_child_position(gtklist, list_item);
+ i = dia_list_child_position(gtklist, list_item);
if (i>0)
i--;
g_object_ref(list_item);
list = g_list_prepend(NULL, list_item);
- gtk_list_remove_items(gtklist, list);
- gtk_list_insert_items(gtklist, list, i);
+ dia_list_remove_items(gtklist, list);
+ dia_list_insert_items(gtklist, list, i);
g_object_unref(list_item);
- gtk_list_select_child(gtklist, list_item);
+ dia_list_select_child(gtklist, list_item);
}
}
@@ -225,27 +223,27 @@ templates_list_move_down_callback(GtkWidget *button,
{
GList *list;
UMLClassDialog *prop_dialog;
- GtkList *gtklist;
- GtkWidget *list_item;
+ DiaList *gtklist;
+ DiaListItem *list_item;
int i;
prop_dialog = umlclass->properties_dialog;
- gtklist = GTK_LIST(prop_dialog->templates_list);
+ gtklist = DIA_LIST(prop_dialog->templates_list);
- if (gtklist->selection != NULL) {
- list_item = GTK_WIDGET(gtklist->selection->data);
+ if (dia_list_get_selection (gtklist) != NULL) {
+ list_item = dia_list_get_selection (gtklist);
- i = gtk_list_child_position(gtklist, list_item);
- if (i<(g_list_length(gtklist->children)-1))
+ i = dia_list_child_position(gtklist, list_item);
+ if (i<(g_list_length(dia_list_get_children (gtklist))-1))
i++;
g_object_ref(list_item);
list = g_list_prepend(NULL, list_item);
- gtk_list_remove_items(gtklist, list);
- gtk_list_insert_items(gtklist, list, i);
+ dia_list_remove_items(gtklist, list);
+ dia_list_insert_items(gtklist, list, i);
g_object_unref(list_item);
- gtk_list_select_child(gtklist, list_item);
+ dia_list_select_child(gtklist, list_item);
}
}
@@ -260,7 +258,7 @@ _templates_read_from_dialog(UMLClass *umlclass, UMLClassDialog *prop_dialog)
_templates_get_current_values(prop_dialog); /* if changed, update from widgets */
- umlclass->template = prop_dialog->templ_template->active;
+ umlclass->template = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (prop_dialog->templ_template));
/* Free current formal parameters: */
list = umlclass->formal_params;
@@ -273,7 +271,7 @@ _templates_read_from_dialog(UMLClass *umlclass, UMLClassDialog *prop_dialog)
umlclass->formal_params = NULL;
/* Insert new formal params and remove them from gtklist: */
- list = GTK_LIST (prop_dialog->templates_list)->children;
+ list = dia_list_get_children (DIA_LIST (prop_dialog->templates_list));
clear_list = NULL;
while (list != NULL) {
list_item = GTK_WIDGET(list->data);
@@ -285,7 +283,7 @@ _templates_read_from_dialog(UMLClass *umlclass, UMLClassDialog *prop_dialog)
list = g_list_next(list);
}
clear_list = g_list_reverse (clear_list);
- gtk_list_remove_items (GTK_LIST (prop_dialog->templates_list), clear_list);
+ dia_list_remove_items (DIA_LIST (prop_dialog->templates_list), clear_list);
g_list_free (clear_list);
}
@@ -302,14 +300,14 @@ _templates_fill_in_dialog(UMLClass *umlclass)
gtk_toggle_button_set_active(prop_dialog->templ_template, umlclass->template);
/* copy in new template-parameters: */
- if (prop_dialog->templates_list->children == NULL) {
+ if (dia_list_get_children (prop_dialog->templates_list) == NULL) {
i = 0;
list = umlclass->formal_params;
while (list != NULL) {
UMLFormalParameter *param = (UMLFormalParameter *)list->data;
gchar *paramstr = uml_get_formalparameter_string(param);
- list_item = gtk_list_item_new_with_label (paramstr);
+ list_item = dia_list_item_new_with_label (paramstr);
param_copy = uml_formalparameter_copy(param);
g_object_set_data(G_OBJECT(list_item), "user_data",
(gpointer) param_copy);
@@ -385,9 +383,9 @@ _templates_create_page(GtkNotebook *notebook, UMLClass *umlclass)
gtk_box_pack_start (GTK_BOX (hbox), scrolled_win, TRUE, TRUE, 0);
gtk_widget_show (scrolled_win);
- list = gtk_list_new ();
- prop_dialog->templates_list = GTK_LIST(list);
- gtk_list_set_selection_mode (GTK_LIST (list), GTK_SELECTION_SINGLE);
+ list = dia_list_new ();
+ prop_dialog->templates_list = DIA_LIST(list);
+ dia_list_set_selection_mode (DIA_LIST (list), GTK_SELECTION_SINGLE);
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_win), list);
gtk_container_set_focus_vadjustment (GTK_CONTAINER (list),
gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW
(scrolled_win)));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]