[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Antiright-devel] antiright/gtkshell Makefile button.c label.c te...
From: |
Jeffrey Bedard |
Subject: |
[Antiright-devel] antiright/gtkshell Makefile button.c label.c te... |
Date: |
Thu, 22 Feb 2007 23:16:45 +0000 |
CVSROOT: /sources/antiright
Module name: antiright
Changes by: Jeffrey Bedard <jefbed> 07/02/22 23:16:45
Modified files:
gtkshell : Makefile button.c label.c text.c
Added files:
gtkshell : font.c font.h
Log message:
Split out font setting code from text.c into font.c for
use by other widgets. Set default label font to monospaced.
Split out setting of label options.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/Makefile?cvsroot=antiright&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/button.c?cvsroot=antiright&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/label.c?cvsroot=antiright&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/text.c?cvsroot=antiright&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/font.c?cvsroot=antiright&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/font.h?cvsroot=antiright&rev=1.1
Patches:
Index: Makefile
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/Makefile,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- Makefile 22 Feb 2007 22:13:02 -0000 1.6
+++ Makefile 22 Feb 2007 23:16:45 -0000 1.7
@@ -10,12 +10,12 @@
objects=gtkshell.o arguments.o options.o callbacks.o updated.o\
label.o button.o text.o updated_label.o
updated_progress.o\
updated_options.o add_options.o
option_options.o dialog_options.o\
- file_dialog.o row.o containers.o geometry.o
+ file_dialog.o row.o containers.o geometry.o
font.o
sources=gtkshell.c arguments.c options.c callbacks.c updated.c\
label.c button.c text.c updated_label.c
updated_progress.c\
updated_options.c add_options.c
option_options.c dialog_options.c\
- file_dialog.c row.c containers.c geometry.c
+ file_dialog.c row.c containers.c geometry.c
font.c
all: $(objects) main.o
$(CC) -o gtkshell $(objects) main.o $(LDFLAGS)
Index: button.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/button.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- button.c 21 Feb 2007 19:44:50 -0000 1.9
+++ button.c 22 Feb 2007 23:16:45 -0000 1.10
@@ -36,6 +36,7 @@
/* Allocate and initialize elements. */
cb = (struct GSH_CBData *) xmalloc (sizeof (struct GSH_CBData));
+ ARPASSERT(gsh);
cb->gsh = gsh;
asprintf ((char **) &cb->data, "%s", command);
@@ -43,7 +44,8 @@
gsh->button = gtk_button_new_with_label (label_text);
free (label_text);
- g_signal_connect (G_OBJECT (gsh->button), "clicked",
+ /address@hidden@*/
+ (void)g_signal_connect (G_OBJECT (gsh->button), "clicked",
G_CALLBACK (system_cb), cb);
gsh_manage_unexpanded (gsh, gsh->button);
Index: label.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/label.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- label.c 21 Feb 2007 16:15:49 -0000 1.7
+++ label.c 22 Feb 2007 23:16:45 -0000 1.8
@@ -23,20 +23,30 @@
#include "gtkshell.h"
+static void
+set_options(struct GSH * gsh, GtkWidget *label)
+{
+ gtk_label_set_single_line_mode (GTK_LABEL (label), FALSE);
+ gtk_label_set_max_width_chars (GTK_LABEL (label), 80);
+
+ if (gsh->flags.horizontal_labels == TRUE)
+ gtk_label_set_angle (GTK_LABEL (label), 270.0);
+ else
+ gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
+
+ gsh_widget_set_font_mono(label);
+}
+
GtkWidget *
gsh_add_label (struct GSH * gsh, char *text)
{
GtkWidget *label;
- label = gtk_label_new (text);
+ ARPASSERT(gsh);
- gtk_label_set_single_line_mode (GTK_LABEL (label), FALSE);
- gtk_label_set_max_width_chars (GTK_LABEL (label), 80);
+ label = gtk_label_new (text);
- if (gsh->flags.horizontal_labels)
- gtk_label_set_angle (GTK_LABEL (label), 270);
- else
- gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
+ set_options(gsh, label);
/* This uses expanded management, as the label may be displaying a large
text area. */
@@ -48,6 +58,8 @@
void
gsh_set_label (GtkWidget * label, char *text)
{
+ ARPASSERT(label);
+ /* Text is not checked, as empty labels are allowed. */
gtk_label_set_text (GTK_LABEL (label), text);
}
Index: text.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/text.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- text.c 21 Feb 2007 21:39:50 -0000 1.8
+++ text.c 22 Feb 2007 23:16:45 -0000 1.9
@@ -1,6 +1,6 @@
/*
AntiRight
- (c) 2002-2006 Jeffrey Bedard
+ (c) 2002-2007 Jeffrey Bedard
address@hidden
This file is part of AntiRight.
@@ -28,15 +28,21 @@
GtkWidget *entry;
struct GSH_CBData *cb;
+ ARPASSERT(gsh);
+
/* Set up callback data. */
cb = (struct GSH_CBData *) xmalloc (sizeof (struct GSH_CBData));
cb->gsh = gsh;
+ if(command != NULL)
asprintf ((char **) &cb->data, "%s", command);
+ else
+ asprintf ((char **) &cb->data, "echo");
/* Create widget. */
entry = gtk_entry_new ();
- g_signal_connect (G_OBJECT (entry), "activate",
+ /address@hidden/
+ (void)g_signal_connect (G_OBJECT (entry), "activate",
G_CALLBACK (entry_cb), (gpointer) cb);
/* Do not fill remaining container area. */
@@ -63,16 +69,21 @@
GtkWidget *text;
GtkTextBuffer *buffer;
GtkTextIter iter;
- PangoFontDescription *font_desc;
size_t read;
FILE *file;
char buf[BUFSIZ];
+ ARPASSERT(gsh);
+
text = gsh_text_area (gsh);
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text));
+ ARPASSERT(filename);
file = fopen (filename, "r");
+
+ ARPASSERT(file);
+
while ((read = fread (buf, sizeof (char), BUFSIZ, file)))
{
gtk_text_buffer_get_end_iter (buffer, &iter);
@@ -80,10 +91,10 @@
}
fclose (file);
- if (!gsh->geometry)
+ if (gsh->geometry == NULL)
asprintf (&gsh->geometry, "775x700");
- font_desc = pango_font_description_from_string ("Mono 14");
- gtk_widget_modify_font (text, font_desc);
- pango_font_description_free (font_desc);
+ gsh_widget_set_font_mono(text);
+
}
+
Index: font.c
===================================================================
RCS file: font.c
diff -N font.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ font.c 22 Feb 2007 23:16:45 -0000 1.1
@@ -0,0 +1,40 @@
+/*
+ AntiRight
+ (c) 2002-2007 Jeffrey Bedard
+ address@hidden
+
+ This file is part of AntiRight.
+
+ AntiRight is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ AntiRight is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with AntiRight; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
USA
+*/
+
+#include "gtkshell.h"
+
+void
+gsh_widget_set_font(GtkWidget *widget, gchar *font)
+{
+ PangoFontDescription *font_desc;
+
+ font_desc = pango_font_description_from_string ("Mono 14");
+ gtk_widget_modify_font (widget, font_desc);
+ pango_font_description_free (font_desc);
+}
+
+void
+gsh_widget_set_font_mono(GtkWidget *widget)
+{
+ gsh_widget_set_font(widget, "Mono 12");
+}
+
Index: font.h
===================================================================
RCS file: font.h
diff -N font.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ font.h 22 Feb 2007 23:16:45 -0000 1.1
@@ -0,0 +1,32 @@
+/*
+ AntiRight
+ (c) 2002-2007 Jeffrey Bedard
+ address@hidden
+
+ This file is part of AntiRight.
+
+ AntiRight is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ AntiRight is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with AntiRight; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
USA
+*/
+
+#ifndef GTKSHELL_FONT_H
+#define GTKSHELL_FONT_H
+
+void
+gsh_widget_set_font(GtkWidget *widget, gchar *font);
+
+void
+gsh_widget_set_font_mono(GtkWidget *widget);
+
+#endif /* GTKSHELL_FONT_H */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Antiright-devel] antiright/gtkshell Makefile button.c label.c te...,
Jeffrey Bedard <=