[Goodies-commits] r5507 - xfbib/branches/gobject/src

Jesper Karlsson zarper at xfce.org
Fri Oct 3 17:56:36 CEST 2008


Author: zarper
Date: 2008-10-03 15:56:36 +0000 (Fri, 03 Oct 2008)
New Revision: 5507

Modified:
   xfbib/branches/gobject/src/xfbib-entry-edit-dialog.c
   xfbib/branches/gobject/src/xfbib-entry-edit-dialog.h
   xfbib/branches/gobject/src/xfbib-value.c
Log:
Minor fixes and code cleanup


Modified: xfbib/branches/gobject/src/xfbib-entry-edit-dialog.c
===================================================================
--- xfbib/branches/gobject/src/xfbib-entry-edit-dialog.c	2008-10-03 13:05:43 UTC (rev 5506)
+++ xfbib/branches/gobject/src/xfbib-entry-edit-dialog.c	2008-10-03 15:56:36 UTC (rev 5507)
@@ -171,7 +171,7 @@
 static void
 xfbib_entry_edit_dialog_init(XfbibEntryEditDialog *instance)
 {
-	gint i;
+	gint i, row[4] = {0, 0, 0, 0};
 	GtkWidget *top_box;
 	
 	instance->type_label = gtk_label_new("Type:");
@@ -189,22 +189,27 @@
 	g_signal_connect(G_OBJECT (instance->key_button), "clicked", G_CALLBACK (cb_generate_clicked), instance);
 
 	/* TODO: Should the type and key widgets be on two seperate rows instead to limit the width? */
-	top_box = gtk_hbox_new(FALSE, 10);
-	gtk_box_pack_start(GTK_BOX(top_box), instance->type_label, FALSE, FALSE, 10);
-	gtk_box_pack_start(GTK_BOX(top_box), instance->type_combo_box, FALSE, FALSE, 10);
+	top_box = gtk_hbox_new(FALSE, 12);
 
-	gtk_box_pack_end(GTK_BOX(top_box), instance->key_button, FALSE, FALSE, 10);
-	gtk_box_pack_end(GTK_BOX(top_box), instance->key_entry, FALSE, FALSE, 10);
-	gtk_box_pack_end(GTK_BOX(top_box), instance->key_label, FALSE, FALSE, 10);
+	gtk_box_pack_start(GTK_BOX(top_box), instance->type_label, FALSE, FALSE, 0);
+	gtk_box_pack_start(GTK_BOX(top_box), instance->type_combo_box, FALSE, FALSE, 0);
+
+	gtk_box_pack_end(GTK_BOX(top_box), instance->key_button, FALSE, FALSE, 0);
+	gtk_box_pack_end(GTK_BOX(top_box), instance->key_entry, FALSE, FALSE, 0);
+	gtk_box_pack_end(GTK_BOX(top_box), instance->key_label, FALSE, FALSE, 0);
 	
-	gtk_box_pack_start (GTK_BOX (GTK_DIALOG (instance)->vbox), top_box, FALSE, FALSE, 10);
+	gtk_box_pack_start (GTK_BOX (GTK_DIALOG (instance)->vbox), top_box, FALSE, FALSE, 0);
 
 
-	instance->note_boxes[0] = gtk_vbox_new(FALSE, 3);
-	instance->note_boxes[1] = gtk_hbox_new(FALSE, 10);
-	instance->note_boxes[2] = gtk_vbox_new(FALSE, 3);
-	instance->note_boxes[3] = gtk_vbox_new(FALSE, 3);
-	instance->note_boxes[4] = gtk_vbox_new(FALSE, 3);
+	instance->note_boxes[0] = gtk_vbox_new(FALSE, 6);
+	instance->note_boxes[1] = gtk_hbox_new(FALSE, 12);
+	instance->note_boxes[2] = gtk_vbox_new(FALSE, 6);
+	instance->note_boxes[3] = gtk_vbox_new(FALSE, 6);
+	instance->note_boxes[4] = gtk_vbox_new(FALSE, 6);
+	for (i = 0; i < 5; i++) {
+		//instance->note_boxes[i] = gtk_table_new(1, 2, TRUE);
+		gtk_container_set_border_width(GTK_CONTAINER (instance->note_boxes[i]), 12);
+	}
 	
 	for (i = 0; i < XFBIB_FIELD_N_FIELDS; i++) {
 		/* Create the Input object */
@@ -215,6 +220,7 @@
 		}
 
 		/* Add the input object to the correct box */
+		/* TODO: Make functions in single input to get each element and then place them in the table */
 		switch (i) {
 			case XFBIB_FIELD_INSTITUTION:
 			case XFBIB_FIELD_ORGANIZATION:
@@ -222,15 +228,15 @@
 			case XFBIB_FIELD_TITLE:
 			case XFBIB_FIELD_TYPE:
 				/* Box 0 */
-				gtk_box_pack_start (GTK_BOX (instance->note_boxes[0]), instance->inputs[i], FALSE, FALSE, 2);
+				gtk_box_pack_start (GTK_BOX (instance->note_boxes[0]), instance->inputs[i], FALSE, FALSE, 0);
 				break;
 			case XFBIB_FIELD_AUTHOR:
 				/* Box 1 */
-				gtk_box_pack_start (GTK_BOX (instance->note_boxes[1]), instance->inputs[i], FALSE, FALSE, 2);
+				gtk_box_pack_start (GTK_BOX (instance->note_boxes[1]), instance->inputs[i], FALSE, FALSE, 0);
 				break;
 			case XFBIB_FIELD_EDITOR:
 				/* Box 1 */
-				gtk_box_pack_end (GTK_BOX (instance->note_boxes[1]), instance->inputs[i], FALSE, FALSE, 2);
+				gtk_box_pack_end (GTK_BOX (instance->note_boxes[1]), instance->inputs[i], FALSE, FALSE, 0);
 				break;
 			case XFBIB_FIELD_BOOKTITLE:
 			case XFBIB_FIELD_CHAPTER:
@@ -241,7 +247,7 @@
 			case XFBIB_FIELD_VOLUME:
 			case XFBIB_FIELD_YEAR:
 				/* Box 2 */
-				gtk_box_pack_start (GTK_BOX (instance->note_boxes[2]), instance->inputs[i], FALSE, FALSE, 2);
+				gtk_box_pack_start (GTK_BOX (instance->note_boxes[2]), instance->inputs[i], FALSE, FALSE, 0);
 				break;
 			case XFBIB_FIELD_ADDRESS:
 			case XFBIB_FIELD_HOWPUBLISHED:
@@ -249,7 +255,7 @@
 			case XFBIB_FIELD_PUBLISHER:
 			case XFBIB_FIELD_SERIES:
 				/* Box 3 */
-				gtk_box_pack_start (GTK_BOX (instance->note_boxes[3]), instance->inputs[i], FALSE, FALSE, 2);
+				gtk_box_pack_start (GTK_BOX (instance->note_boxes[3]), instance->inputs[i], FALSE, FALSE, 0);
 				break;
 			case XFBIB_FIELD_ANNOTE:
 			case XFBIB_FIELD_CROSSREF:
@@ -258,7 +264,7 @@
 			case XFBIB_FIELD_NOTE:
 			case XFBIB_FIELD_URL:
 				/* Box 4 */
-				gtk_box_pack_start (GTK_BOX (instance->note_boxes[4]), instance->inputs[i], FALSE, FALSE, 2);
+				gtk_box_pack_start (GTK_BOX (instance->note_boxes[4]), instance->inputs[i], FALSE, FALSE, 0);
 				break;
 		}
 	}
@@ -271,7 +277,7 @@
 	gtk_notebook_append_page (GTK_NOTEBOOK (instance->notebook), instance->note_boxes[3], gtk_label_new("Publisher"));	
 	gtk_notebook_append_page (GTK_NOTEBOOK (instance->notebook), instance->note_boxes[4], gtk_label_new("Misc"));	
 
-	gtk_box_pack_start (GTK_BOX (GTK_DIALOG (instance)->vbox), instance->notebook, TRUE, TRUE, 10);
+	gtk_box_pack_start (GTK_BOX (GTK_DIALOG (instance)->vbox), instance->notebook, TRUE, TRUE, 0);
 
 	/* Add OK and cancel button */
 	gtk_dialog_add_button (GTK_DIALOG (instance), GTK_STOCK_OK, GTK_RESPONSE_OK);
@@ -342,31 +348,31 @@
 	int n;
 
 	entry = xfbib_entry_new();
-	xfbib_entry_set_key(entry, gtk_entry_get_text(entry_edit_dialog->key_entry));
-	xfbib_entry_set_bibtype(entry, gtk_combo_box_get_active_text(entry_edit_dialog->type_combo_box));
+	xfbib_entry_set_key(entry, gtk_entry_get_text(GTK_ENTRY(entry_edit_dialog->key_entry)));
+	xfbib_entry_set_bibtype(entry, gtk_combo_box_get_active_text(GTK_COMBO_BOX(entry_edit_dialog->type_combo_box)));
 	for (n = 0; n < XFBIB_FIELD_N_FIELDS; n++) {
 		if (n == XFBIB_FIELD_AUTHOR || n == XFBIB_FIELD_EDITOR) {
-			if(xfbib_multiple_input_get_str(entry_edit_dialog->inputs[n]) == "") {
+			if(xfbib_multiple_input_get_str(XFBIB_MULTIPLE_INPUT(entry_edit_dialog->inputs[n])) == "") {
 				continue;
 			}
 			/* TODO: check if they are integers or strings(variables), don't assume text */
 			field = xfbib_field_new();
 			xfbib_field_set_variable(field, xfbib_input_constants[n].label);
 			value = xfbib_value_new();
-			xfbib_value_set_str(value, xfbib_multiple_input_get_str(entry_edit_dialog->inputs[n]));
+			xfbib_value_set_str(value, xfbib_multiple_input_get_str(XFBIB_MULTIPLE_INPUT(entry_edit_dialog->inputs[n])));
 			xfbib_field_set_value(field, value);
-			g_list_append(field_list, field);
+			field_list = g_list_append(field_list, field);
 		} else {
-			if(xfbib_single_input_get_entry_text(entry_edit_dialog->inputs[n]) == "") {
+			if(xfbib_single_input_get_entry_text(XFBIB_SINGLE_INPUT(entry_edit_dialog->inputs[n])) == "") {
 				continue;
 			}
 			/* TODO: check if they are integers or strings(variables), don't assume text */
 			field = xfbib_field_new();
 			xfbib_field_set_variable(field, xfbib_input_constants[n].label);
 			value = xfbib_value_new();
-			xfbib_value_set_str(value, xfbib_single_input_get_entry_text(entry_edit_dialog->inputs[n]));
+			xfbib_value_set_str(value, xfbib_single_input_get_entry_text(XFBIB_SINGLE_INPUT(entry_edit_dialog->inputs[n])));
 			xfbib_field_set_value(field, value);
-			g_list_append(field_list, field);
+			field_list = g_list_append(field_list, field);
 		}
 	}
 	xfbib_entry_set_fields(entry, field_list);

Modified: xfbib/branches/gobject/src/xfbib-entry-edit-dialog.h
===================================================================
--- xfbib/branches/gobject/src/xfbib-entry-edit-dialog.h	2008-10-03 13:05:43 UTC (rev 5506)
+++ xfbib/branches/gobject/src/xfbib-entry-edit-dialog.h	2008-10-03 15:56:36 UTC (rev 5507)
@@ -37,6 +37,7 @@
 GType xfbib_entry_edit_dialog_get_type() G_GNUC_CONST;
 
 GtkWidget *xfbib_entry_edit_dialog_new(XfbibEntry *);
+XfbibEntry *xfbib_entry_edit_dialog_get_entry(XfbibEntryEditDialog *);
 
 G_END_DECLS
 

Modified: xfbib/branches/gobject/src/xfbib-value.c
===================================================================
--- xfbib/branches/gobject/src/xfbib-value.c	2008-10-03 13:05:43 UTC (rev 5506)
+++ xfbib/branches/gobject/src/xfbib-value.c	2008-10-03 15:56:36 UTC (rev 5507)
@@ -176,9 +176,12 @@
 void
 xfbib_value_set_str(XfbibValue *value, const gchar *str)
 {
+	XfbibStrbuf *strbuf;
 	GList *list;
 
-	g_list_append(list, G_OBJECT(str));
+	strbuf = xfbib_strbuf_new();
+	xfbib_strbuf_append(strbuf, str);
+	list = g_list_append(list, G_OBJECT(strbuf));
 	if(value->list != NULL) {
 		/* TODO: Free the list */
 	}




More information about the Goodies-commits mailing list