2 #include "tilda-terminal.h"
3 #include "tilda-terminal-dbus-glue.h"
5 // FIXME: temporary helpers for gettext
11 tilda_terminal_dbus_register_object (TildaTerminal *tt)
15 // Register this object with DBus
16 object_path = g_strdup_printf ("/net/sourceforge/Tilda/Window%d/Terminal%d",
17 tt->window_number, tt->number);
18 dbus_g_connection_register_g_object (dbus_connection, object_path, G_OBJECT(tt));
23 * Start the current tt->shell in the given TildaTerminal
24 * NOTE: this will kill whatever is running in the terminal,
25 * NOTE: and run the current tt->shell instead :)
26 * Return: TRUE if ok, FALSE otherwise
29 tilda_terminal_start_shell (TildaTerminal *tt)
36 /* Launch a custom command if tt->shell is set (not NULL) */
39 /* Try to parse the user's custom command */
40 ret = g_shell_parse_argv (tt->shell, &argc, &argv, &error);
44 g_printerr (_("Problem parsing custom command: %s\n"), error->message);
45 g_printerr (_("Launching default shell instead\n"));
48 goto launch_default_shell;
51 /* Try to start the user's custom command */
52 ret = vte_terminal_fork_command (VTE_TERMINAL(tt->vte_term),
53 argv[0], /* Command */
54 argv, /* Arg Vector */
55 NULL, /* Env Vector */
56 tt->working_directory, /* Start directory */
57 TRUE, /* Add to lastlog */
58 TRUE, /* Add to utmp */
59 TRUE); /* Add to wtmp */
66 g_printerr (_("Unable to launch custom command: %s\n"), tt->shell);
67 g_printerr (_("Launching default shell instead\n"));
69 goto launch_default_shell;
72 return TRUE; /* SUCCESS: the early way out */
77 ret = vte_terminal_fork_command (VTE_TERMINAL(tt->vte_term),
78 NULL, /* Command -- VTE will figure it out */
79 NULL, /* Arg Vector */
80 NULL, /* Env Vector */
81 tt->working_directory, /* Start Directory */
82 TRUE, /* Add to lastlog */
83 TRUE, /* Add to utmp */
84 TRUE);/* Add to wtmp */
88 g_printerr (_("Unable to launch default shell\n"));
96 * Called when the child process running in the VteTerminal exits.
99 child_exited_cb (GtkWidget *widget, gpointer data)
101 TildaTerminal *self = TILDA_TERMINAL(data);
103 /* These can stay here. They don't need to go into a header because
104 * they are only used at this point in the code. */
105 enum exit_actions { HOLD_TERMINAL_OPEN, RESTART_COMMAND, EXIT_TERMINAL };
107 /* Check the user's preference for what to do when the child terminal
108 * is closed. Take the appropriate action */
109 switch (self->exit_action)
112 tilda_window_remove_term (TILDA_WINDOW(self->parent_window), self->number);
114 case RESTART_COMMAND:
115 vte_terminal_feed (VTE_TERMINAL(self->vte_term), "\r\n\r\n", 4);
116 tilda_terminal_start_shell (self);
118 case HOLD_TERMINAL_OPEN:
125 /*******************************************************************************
126 * All GObject stuff is below. You probably don't need to change this...
127 ******************************************************************************/
129 static GObjectClass *parent_class = NULL;
131 enum tilda_terminal_properties {
132 TILDA_TERMINAL_NUMBER = 1,
133 TILDA_TERMINAL_WINDOW_NUMBER,
136 /* All non-constructor-only properties */
137 TILDA_TERMINAL_BACKGROUND_IMAGE,
138 TILDA_TERMINAL_SHELL,
140 TILDA_TERMINAL_TITLE,
141 TILDA_TERMINAL_WORKING_DIRECTORY,
143 TILDA_TERMINAL_SCROLLBACK_LINES,
144 TILDA_TERMINAL_TRANSPARENCY_PERCENT,
146 TILDA_TERMINAL_BACKSPACE_BINDING,
147 TILDA_TERMINAL_DELETE_BINDING,
148 TILDA_TERMINAL_DYNAMIC_TITLE,
149 TILDA_TERMINAL_EXIT_ACTION,
151 TILDA_TERMINAL_SCROLL_BACKGROUND,
152 TILDA_TERMINAL_SCROLL_ON_OUTPUT,
153 TILDA_TERMINAL_SCROLL_ON_KEYSTROKE,
154 TILDA_TERMINAL_ANTIALIASED,
155 TILDA_TERMINAL_ALLOW_BOLD_TEXT,
156 TILDA_TERMINAL_CURSOR_BLINKS,
157 TILDA_TERMINAL_AUDIBLE_BELL,
158 TILDA_TERMINAL_VISIBLE_BELL,
159 TILDA_TERMINAL_DOUBLE_BUFFERED,
160 TILDA_TERMINAL_MOUSE_AUTOHIDE,
164 tilda_terminal_instance_init (GTypeInstance *instance,
167 TildaTerminal *self = (TildaTerminal *) instance;
169 /* Initialize instance members and allocate any necessary memory here.
170 * NOTE: any constructor-time values will be set later. */
171 self->dispose_has_run = FALSE;
174 self->vte_term = vte_terminal_new ();
175 self->scrollbar = gtk_vscrollbar_new (VTE_TERMINAL(self->vte_term)->adjustment);
176 self->hbox = gtk_hbox_new (FALSE, 0);
180 tilda_terminal_set_property (GObject *object,
185 TildaTerminal *self = (TildaTerminal *) object;
187 switch (property_id) {
189 case TILDA_TERMINAL_NUMBER:
190 self->number = g_value_get_int (value);
191 g_print ("terminal number: %d\n", self->number);
194 case TILDA_TERMINAL_WINDOW_NUMBER:
195 self->window_number = g_value_get_int (value);
196 g_print ("terminal parent window number: %d\n", self->window_number);
199 case TILDA_TERMINAL_TW:
200 self->parent_window = g_value_get_pointer (value);
201 g_print ("terminal parent window: 0x%x\n", self->parent_window);
202 g_print ("terminal parent window number (direct): %d\n", TILDA_WINDOW(self->parent_window)->number);
205 case TILDA_TERMINAL_BACKGROUND_IMAGE:
206 g_free (self->background_image);
207 self->background_image = g_value_dup_string (value);
208 vte_terminal_set_background_image_file (VTE_TERMINAL(self->vte_term), self->background_image);
209 g_print ("terminal back img: %s\n", self->background_image);
212 case TILDA_TERMINAL_SHELL:
213 g_free (self->shell);
214 self->shell = g_value_dup_string (value);
215 tilda_terminal_start_shell (self);
216 g_print ("terminal shell: %s\n", self->shell);
219 case TILDA_TERMINAL_FONT:
221 self->font = g_value_dup_string (value);
222 vte_terminal_set_font_from_string_full (VTE_TERMINAL(self->vte_term),
225 g_print ("terminal font: %s\n", self->font);
228 case TILDA_TERMINAL_TITLE:
229 g_free (self->title);
230 self->title = g_value_dup_string (value);
231 g_print ("terminal title: %s\n", self->title);
234 case TILDA_TERMINAL_WORKING_DIRECTORY:
235 g_free (self->working_directory);
236 self->working_directory = g_value_dup_string (value);
237 g_print ("terminal wrk dir: %s\n", self->working_directory);
240 case TILDA_TERMINAL_SCROLLBACK_LINES:
241 self->scrollback_lines = g_value_get_int (value);
242 vte_terminal_set_scrollback_lines (VTE_TERMINAL(self->vte_term), self->scrollback_lines);
243 g_print ("terminal scrollback lines: %d\n", self->scrollback_lines);
246 case TILDA_TERMINAL_TRANSPARENCY_PERCENT:
247 self->transparency_percent = g_value_get_int (value);
248 g_print ("terminal transp percent: %d\n", self->transparency_percent);
251 case TILDA_TERMINAL_BACKSPACE_BINDING:
252 self->backspace_binding = g_value_get_int (value);
253 vte_terminal_set_backspace_binding (VTE_TERMINAL(self->vte_term), self->backspace_binding);
254 g_print ("terminal backspace key: %d\n", self->backspace_binding);
257 case TILDA_TERMINAL_DELETE_BINDING:
258 self->delete_binding = g_value_get_int (value);
259 vte_terminal_set_delete_binding (VTE_TERMINAL(self->vte_term), self->delete_binding);
260 g_print ("terminal delete key: %d\n", self->delete_binding);
263 case TILDA_TERMINAL_DYNAMIC_TITLE:
264 self->dynamic_title = g_value_get_int (value);
265 g_print ("terminal dynamic title: %d\n", self->dynamic_title);
268 case TILDA_TERMINAL_EXIT_ACTION:
269 self->exit_action = g_value_get_int (value);
270 g_print ("terminal exit action: %d\n", self->exit_action);
273 case TILDA_TERMINAL_SCROLL_BACKGROUND:
274 self->scroll_background = g_value_get_boolean (value);
275 vte_terminal_set_scroll_background (VTE_TERMINAL(self->vte_term), self->scroll_background);
276 g_print ("terminal scroll background: %d\n", self->scroll_background);
279 case TILDA_TERMINAL_SCROLL_ON_OUTPUT:
280 self->scroll_on_output = g_value_get_boolean (value);
281 vte_terminal_set_scroll_on_output (VTE_TERMINAL(self->vte_term), self->scroll_on_output);
282 g_print ("terminal scroll on output: %d\n", self->scroll_on_output);
285 case TILDA_TERMINAL_SCROLL_ON_KEYSTROKE:
286 self->scroll_on_keystroke = g_value_get_boolean (value);
287 vte_terminal_set_scroll_on_keystroke (VTE_TERMINAL(self->vte_term), self->scroll_on_keystroke);
288 g_print ("terminal scroll on keystroke: %d\n", self->scroll_on_keystroke);
291 case TILDA_TERMINAL_ANTIALIASED:
292 self->antialiased = g_value_get_boolean (value);
293 vte_terminal_set_font_from_string_full (VTE_TERMINAL(self->vte_term),
296 g_print ("terminal antialiased: %d\n", self->antialiased);
299 case TILDA_TERMINAL_ALLOW_BOLD_TEXT:
300 self->allow_bold_text = g_value_get_boolean (value);
301 vte_terminal_set_allow_bold (VTE_TERMINAL(self->vte_term), self->allow_bold_text);
302 g_print ("terminal allow bold text: %d\n", self->allow_bold_text);
305 case TILDA_TERMINAL_CURSOR_BLINKS:
306 self->cursor_blinks = g_value_get_boolean (value);
307 vte_terminal_set_cursor_blinks (VTE_TERMINAL(self->vte_term), self->cursor_blinks);
308 g_print ("terminal cursor blinks: %d\n", self->cursor_blinks);
311 case TILDA_TERMINAL_AUDIBLE_BELL:
312 self->audible_bell = g_value_get_boolean (value);
313 vte_terminal_set_audible_bell (VTE_TERMINAL(self->vte_term), self->audible_bell);
314 g_print ("terminal audible bell: %d\n", self->audible_bell);
317 case TILDA_TERMINAL_VISIBLE_BELL:
318 self->visible_bell = g_value_get_boolean (value);
319 vte_terminal_set_visible_bell (VTE_TERMINAL(self->vte_term), self->visible_bell);
320 g_print ("terminal visible bell: %d\n", self->visible_bell);
323 case TILDA_TERMINAL_DOUBLE_BUFFERED:
324 self->double_buffered = g_value_get_boolean (value);
325 gtk_widget_set_double_buffered (GTK_WIDGET(self->vte_term), self->double_buffered);
326 g_print ("terminal double buffered: %d\n", self->double_buffered);
329 case TILDA_TERMINAL_MOUSE_AUTOHIDE:
330 self->mouse_autohide = g_value_get_boolean (value);
331 vte_terminal_set_mouse_autohide (VTE_TERMINAL(self->vte_term), self->mouse_autohide);
332 g_print ("terminal mouse autohide: %d\n", self->mouse_autohide);
336 /* We don't have this property... */
337 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
343 tilda_terminal_get_property (GObject *object,
348 TildaTerminal *self = (TildaTerminal *) object;
350 switch (property_id) {
352 case TILDA_TERMINAL_NUMBER:
353 g_value_set_int (value, self->number);
356 case TILDA_TERMINAL_WINDOW_NUMBER:
357 g_value_set_int (value, self->window_number);
360 case TILDA_TERMINAL_TW:
361 g_value_set_pointer (value, self->parent_window);
364 case TILDA_TERMINAL_BACKGROUND_IMAGE:
365 g_value_set_string (value, self->background_image);
368 case TILDA_TERMINAL_SHELL:
369 g_value_set_string (value, self->shell);
372 case TILDA_TERMINAL_FONT:
373 g_value_set_string (value, self->font);
376 case TILDA_TERMINAL_TITLE:
377 g_value_set_string (value, self->title);
380 case TILDA_TERMINAL_WORKING_DIRECTORY:
381 g_value_set_string (value, self->working_directory);
384 case TILDA_TERMINAL_SCROLLBACK_LINES:
385 g_value_set_int (value, self->scrollback_lines);
388 case TILDA_TERMINAL_TRANSPARENCY_PERCENT:
389 g_value_set_int (value, self->transparency_percent);
392 case TILDA_TERMINAL_BACKSPACE_BINDING:
393 g_value_set_int (value, self->backspace_binding);
396 case TILDA_TERMINAL_DELETE_BINDING:
397 g_value_set_int (value, self->delete_binding);
400 case TILDA_TERMINAL_DYNAMIC_TITLE:
401 g_value_set_int (value, self->dynamic_title);
404 case TILDA_TERMINAL_EXIT_ACTION:
405 g_value_set_int (value, self->exit_action);
408 case TILDA_TERMINAL_SCROLL_BACKGROUND:
409 g_value_set_boolean (value, self->scroll_background);
412 case TILDA_TERMINAL_SCROLL_ON_OUTPUT:
413 g_value_set_boolean (value, self->scroll_on_output);
416 case TILDA_TERMINAL_SCROLL_ON_KEYSTROKE:
417 g_value_set_boolean (value, self->scroll_on_keystroke);
420 case TILDA_TERMINAL_ANTIALIASED:
421 g_value_set_boolean (value, self->antialiased);
424 case TILDA_TERMINAL_ALLOW_BOLD_TEXT:
425 g_value_set_boolean (value, self->allow_bold_text);
428 case TILDA_TERMINAL_CURSOR_BLINKS:
429 g_value_set_boolean (value, self->cursor_blinks);
432 case TILDA_TERMINAL_AUDIBLE_BELL:
433 g_value_set_boolean (value, self->audible_bell);
436 case TILDA_TERMINAL_VISIBLE_BELL:
437 g_value_set_boolean (value, self->visible_bell);
440 case TILDA_TERMINAL_DOUBLE_BUFFERED:
441 g_value_set_boolean (value, self->double_buffered);
444 case TILDA_TERMINAL_MOUSE_AUTOHIDE:
445 g_value_set_boolean (value, self->mouse_autohide);
448 /* We don't have this property... */
449 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
455 tilda_terminal_constructor (GType type,
456 guint n_construct_properties,
457 GObjectConstructParam *construct_properties)
462 /* Invoke parent constructor */
463 TildaTerminalClass *klass;
464 klass = TILDA_TERMINAL_CLASS (g_type_class_peek (TILDA_TYPE_TERMINAL));
465 obj = parent_class->constructor (type,
466 n_construct_properties,
467 construct_properties);
469 /* Do other stuff here. The object is ready to go now, and all
470 * ctor properties have been set.
472 * TODO: This is the place to do DBus-init */
473 self = TILDA_TERMINAL(obj);
475 /* Pack into the hbox */
476 gtk_box_pack_end (GTK_BOX(self->hbox), self->scrollbar, FALSE, FALSE, 0);
477 gtk_box_pack_end (GTK_BOX(self->hbox), self->vte_term, TRUE, TRUE, 0);
478 gtk_widget_show (self->scrollbar);
481 /* Connect Signals */
482 g_signal_connect (G_OBJECT(self->vte_term), "child-exited",
483 G_CALLBACK(child_exited_cb), self);
484 g_signal_connect (G_OBJECT(self->vte_term), "eof",
485 G_CALLBACK(child_exited_cb), self);
487 tilda_terminal_start_shell (self);
488 tilda_terminal_dbus_register_object (self);
494 tilda_terminal_dispose (GObject *obj)
496 TildaTerminal *self = (TildaTerminal *) obj;
498 /* We don't want to run dispose twice, so just return immediately */
499 if (self->dispose_has_run)
502 self->dispose_has_run = TRUE;
505 * In dispose, you are supposed to free all types referenced from this
506 * object which might themselves hold a reference to self. Generally,
507 * the most simple solution is to unref all members on which you own a
511 /* Chain up to the parent class */
512 G_OBJECT_CLASS (parent_class)->dispose (obj);
516 tilda_terminal_finalize (GObject *obj)
518 TildaTerminal *self = (TildaTerminal *) obj;
521 * Here, complete object destruction.
522 * You might not need to do much...
525 // TODO: g_free() any primitives here
526 g_free (self->background_image);
527 g_free (self->shell);
529 g_free (self->title);
530 g_free (self->working_directory);
533 /* Chain up to the parent class */
534 G_OBJECT_CLASS (parent_class)->finalize (obj);
538 tilda_terminal_class_init (gpointer g_class,
539 gpointer g_class_data)
541 GObjectClass *gobject_class = G_OBJECT_CLASS (g_class);
542 TildaTerminalClass *klass = TILDA_TERMINAL_CLASS (g_class);
545 /* Hook our functions to this type */
546 gobject_class->set_property = tilda_terminal_set_property;
547 gobject_class->get_property = tilda_terminal_get_property;
548 gobject_class->dispose = tilda_terminal_dispose;
549 gobject_class->finalize = tilda_terminal_finalize;
550 gobject_class->constructor = tilda_terminal_constructor;
552 parent_class = g_type_class_peek_parent (klass);
554 /* Hook the TildaTerminal type into DBus */
555 dbus_g_object_type_install_info (tilda_terminal_get_type(), &dbus_glib_tilda_terminal_object_info);
557 /* Install all of the properties */
558 pspec = g_param_spec_int ("number",
560 "Set terminal's number",
562 INT_MAX, // max value
564 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE);
566 g_object_class_install_property (gobject_class,
567 TILDA_TERMINAL_NUMBER,
570 pspec = g_param_spec_int ("window-number",
571 "Number of the window to which this terminal belongs",
572 "Set the number of the parent window",
576 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE);
578 g_object_class_install_property (gobject_class,
579 TILDA_TERMINAL_WINDOW_NUMBER,
582 pspec = g_param_spec_pointer ("parent-window",
583 "Pointer to terminal's parent TildaWindow",
584 "Set the pointer to the terminal's parent TildaWindow",
585 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE);
587 g_object_class_install_property (gobject_class,
591 pspec = g_param_spec_string ("background-image",
592 "Terminal's background image",
593 "Get/Set terminal's background image",
597 g_object_class_install_property (gobject_class,
598 TILDA_TERMINAL_BACKGROUND_IMAGE,
601 pspec = g_param_spec_string ("shell",
603 "Get/Set terminal's shell",
607 g_object_class_install_property (gobject_class,
608 TILDA_TERMINAL_SHELL,
611 pspec = g_param_spec_string ("font",
613 "Get/Set terminal's font",
617 g_object_class_install_property (gobject_class,
621 pspec = g_param_spec_string ("title",
623 "Get/Set terminal's title",
627 g_object_class_install_property (gobject_class,
628 TILDA_TERMINAL_TITLE,
631 pspec = g_param_spec_string ("working-directory",
632 "Terminal's initial working directory",
633 "Get/Set terminal's initial working directory",
637 g_object_class_install_property (gobject_class,
638 TILDA_TERMINAL_WORKING_DIRECTORY,
641 pspec = g_param_spec_int ("scrollback-lines",
642 "Terminal's scrollback amount (lines)",
643 "Get/Set terminal's scrollback amount",
645 INT_MAX, // TODO: artificially limit this?
649 g_object_class_install_property (gobject_class,
650 TILDA_TERMINAL_SCROLLBACK_LINES,
653 pspec = g_param_spec_int ("transparency-percent",
654 "Terminal's transparency (percent)",
655 "Get/Set terminal's transparency",
661 g_object_class_install_property (gobject_class,
662 TILDA_TERMINAL_TRANSPARENCY_PERCENT,
665 pspec = g_param_spec_int ("backspace-binding",
666 "Terminal's backspace binding",
667 "Get/Set terminal's backspace key binding",
669 VTE_ERASE_DELETE_SEQUENCE,
673 g_object_class_install_property (gobject_class,
674 TILDA_TERMINAL_BACKSPACE_BINDING,
677 pspec = g_param_spec_int ("delete-binding",
678 "Terminal's delete binding",
679 "Get/Set terminal's delete key binding",
681 VTE_ERASE_DELETE_SEQUENCE,
685 g_object_class_install_property (gobject_class,
686 TILDA_TERMINAL_DELETE_BINDING,
689 pspec = g_param_spec_int ("dynamic-title",
690 "Terminal's dynamic title generation method",
691 "Get/Set terminal's dynamic title generation method",
697 g_object_class_install_property (gobject_class,
698 TILDA_TERMINAL_DYNAMIC_TITLE,
701 pspec = g_param_spec_int ("exit-action",
702 "Terminal's action upon child exit",
703 "Get/Set terminal's action upon child exit",
709 g_object_class_install_property (gobject_class,
710 TILDA_TERMINAL_EXIT_ACTION,
713 pspec = g_param_spec_boolean ("scroll-background",
714 "Controls terminal's scrolling behavior",
715 "Get/Set terminal's scrolling behavior",
719 g_object_class_install_property (gobject_class,
720 TILDA_TERMINAL_SCROLL_BACKGROUND,
723 pspec = g_param_spec_boolean ("scroll-on-output",
724 "Controls terminal's scrolling behavior on output",
725 "Get/Set terminal's scrolling behavior on output",
729 g_object_class_install_property (gobject_class,
730 TILDA_TERMINAL_SCROLL_ON_OUTPUT,
733 pspec = g_param_spec_boolean ("scroll-on-keystroke",
734 "Controls the terminal's scrolling behavior on keystroke",
735 NULL, FALSE, G_PARAM_READWRITE);
737 g_object_class_install_property (gobject_class,
738 TILDA_TERMINAL_SCROLL_ON_KEYSTROKE,
741 pspec = g_param_spec_boolean ("antialiased",
742 "Attempt to antialias fonts",
743 NULL, FALSE, G_PARAM_READWRITE);
745 g_object_class_install_property (gobject_class,
746 TILDA_TERMINAL_ANTIALIASED,
749 pspec = g_param_spec_boolean ("allow-bold-text",
751 NULL, FALSE, G_PARAM_READWRITE);
753 g_object_class_install_property (gobject_class,
754 TILDA_TERMINAL_ALLOW_BOLD_TEXT,
757 pspec = g_param_spec_boolean ("cursor-blinks",
758 NULL, NULL, FALSE, G_PARAM_READWRITE);
760 g_object_class_install_property (gobject_class,
761 TILDA_TERMINAL_CURSOR_BLINKS,
764 pspec = g_param_spec_boolean ("audible-bell",
765 NULL, NULL, FALSE, G_PARAM_READWRITE);
767 g_object_class_install_property (gobject_class,
768 TILDA_TERMINAL_AUDIBLE_BELL,
771 pspec = g_param_spec_boolean ("visible-bell",
772 NULL, NULL, FALSE, G_PARAM_READWRITE);
774 g_object_class_install_property (gobject_class,
775 TILDA_TERMINAL_VISIBLE_BELL,
778 pspec = g_param_spec_boolean ("double-buffered",
779 NULL, NULL, FALSE, G_PARAM_READWRITE);
781 g_object_class_install_property (gobject_class,
782 TILDA_TERMINAL_DOUBLE_BUFFERED,
785 pspec = g_param_spec_boolean ("mouse-autohide",
786 NULL, NULL, FALSE, G_PARAM_READWRITE);
788 g_object_class_install_property (gobject_class,
789 TILDA_TERMINAL_MOUSE_AUTOHIDE,
794 tilda_terminal_get_type (void)
796 static GType type = 0;
800 static const GTypeInfo info = {
801 sizeof (TildaTerminalClass),
802 NULL, /* base_init */
803 NULL, /* base_finalize */
804 tilda_terminal_class_init, /* class_init */
805 NULL, /* class_finalize */
806 NULL, /* class_data */
807 sizeof (TildaTerminal),
809 tilda_terminal_instance_init, /* instance_init */
812 type = g_type_register_static (G_TYPE_OBJECT,
823 int main (int argc, char *argv[])
826 gint test_number = INT_MIN;
827 gchar *test_string = NULL;
829 /* Initialize the GObject type system */
831 gtk_init (&argc, &argv);
833 tt = g_object_new (TILDA_TYPE_TERMINAL, "number", 10, NULL);
834 g_object_get (G_OBJECT (tt), "number", &test_number, NULL);
835 g_assert (test_number == 10);
837 g_object_unref (G_OBJECT (tt));
839 tt = g_object_new (TILDA_TYPE_TERMINAL, "number", 22, NULL);
840 g_object_get (G_OBJECT (tt), "number", &test_number, NULL);
841 g_assert (test_number == 22);
843 g_object_set (G_OBJECT (tt), "font", "hello I'm a font");
844 g_object_set (G_OBJECT (tt), "font", "Bitstream Vera Sans Mono 13");
846 g_object_get (G_OBJECT (tt), "font", &test_string, NULL);
847 g_print ("Read Font: %s\n", test_string);
848 // NOTE: you MUST free the string!!!!
849 g_free (test_string);
851 g_object_set (G_OBJECT (tt), "transparency-percent", 50);
853 g_object_unref (G_OBJECT (tt));
860 /* vim: set ts=4 sts=4 sw=4 noet tw=112: */