Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=grape.git;a=commitdiff;h=5c9112551a2bb5399ceab3b9922ea4847a35e67e

commit 5c9112551a2bb5399ceab3b9922ea4847a35e67e
Author: James Buren <r...@frugalware.org>
Date:   Sat Apr 3 09:47:46 2010 -0500

src
* initial import

diff --git a/src/Makefile b/src/Makefile
new file mode 100644
index 0000000..db509f7
--- /dev/null
+++ b/src/Makefile
@@ -0,0 +1,44 @@
+# Copyright (c) 2010 James Buren
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+CFLAGS ?= -Os
+
+CFLAGS += -ansi -pedantic
+
+CFLAGS += -Wall -Wextra
+
+CFLAGS += -g
+
+CFLAGS += $(strip $(shell pkg-config --cflags gtksourceview-2.0))
+
+LDFLAGS += $(strip $(shell pkg-config --libs gtksourceview-2.0))
+
+TARGET = grape
+
+OBJECTS = $(patsubst %.c,%.o,$(wildcard *.c))
+
+%.o: %.c
+       $(CC) $(CFLAGS) -c $< -o $@
+
+$(TARGET): $(OBJECTS)
+       $(CC) $(LDFLAGS) $^ -o $@
+
+clean:
+       $(RM) $(TARGET) *.o
diff --git a/src/box_pack_widgets.c b/src/box_pack_widgets.c
new file mode 100644
index 0000000..f338757
--- /dev/null
+++ b/src/box_pack_widgets.c
@@ -0,0 +1,33 @@
+// Copyright (c) 2010 James Buren
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to 
deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#include "exports.h"
+
+void box_pack_widgets(GtkWidget *box,gboolean expand,...) {
+  va_list args;
+  GtkWidget *child;
+
+  va_start(args,expand);
+
+  while((child = va_arg(args,GtkWidget *)))
+    gtk_box_pack_start(GTK_BOX(box),child,expand,expand,0);
+
+  va_end(args);
+}
diff --git a/src/exports.h b/src/exports.h
new file mode 100644
index 0000000..f86c7c1
--- /dev/null
+++ b/src/exports.h
@@ -0,0 +1,48 @@
+// Copyright (c) 2010 James Buren
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to 
deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+/* Place all common exports in this header (functions, variables, ...) */
+#ifndef _exports_header_
+#define _exports_header_
+#include <gtksourceview/gtksourceview.h>
+
+typedef struct SharedInfo {
+  GtkSourceView *view;
+  GtkSourceBuffer *buffer;
+  GtkImage *action_icon;
+  GtkLabel *action;
+  GtkLabel *line;
+  GtkLabel *column;
+  GtkLabel *input;
+} SharedInfo;
+
+GtkWidget *label_new(const gchar *text,gboolean bold);
+GtkToolItem *tool_button_new(const gchar *stock,void (*action) (GtkToolButton 
*,SharedInfo *),SharedInfo *info);
+GtkWidget *toolbar_new(SharedInfo *info);
+GtkWidget *text_widget_new(SharedInfo *info);
+GtkWidget *statusbar_new(SharedInfo *info);
+GtkWidget *window_new(void);
+void box_pack_widgets(GtkWidget *box,gboolean expand,...);
+void new_action(GtkToolButton *btn,SharedInfo *info);
+void save_action(GtkToolButton *btn,SharedInfo *info);
+void open_action(GtkToolButton *btn,SharedInfo *info);
+void input_action(GtkTextView *view,SharedInfo *info);
+gint main(gint argc,gchar **argv);
+#endif
diff --git a/src/input_action.c b/src/input_action.c
new file mode 100644
index 0000000..15efa55
--- /dev/null
+++ b/src/input_action.c
@@ -0,0 +1,25 @@
+// Copyright (c) 2010 James Buren
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to 
deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#include "exports.h"
+
+void input_action(GtkTextView *view,SharedInfo *info) {
+  gtk_label_set_text(info->input,(gtk_text_view_get_overwrite(view)) ? "OVR" : 
"INS");
+}
diff --git a/src/label_new.c b/src/label_new.c
new file mode 100644
index 0000000..0159d5b
--- /dev/null
+++ b/src/label_new.c
@@ -0,0 +1,40 @@
+// Copyright (c) 2010 James Buren
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to 
deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#include "exports.h"
+
+GtkWidget *label_new(const gchar *text,gboolean bold) {
+  GtkWidget *label;
+  PangoAttrList *attrs;
+
+  label = gtk_label_new(text);
+
+  attrs = pango_attr_list_new();
+
+  pango_attr_list_insert(attrs,pango_attr_style_new(PANGO_STYLE_NORMAL));
+
+  pango_attr_list_insert(attrs,pango_attr_weight_new((bold) ? 
PANGO_WEIGHT_BOLD : PANGO_WEIGHT_NORMAL));
+
+  gtk_label_set_attributes(GTK_LABEL(label),attrs);
+
+  pango_attr_list_unref(attrs);
+
+  return label;
+}
diff --git a/src/main.c b/src/main.c
new file mode 100644
index 0000000..eb91593
--- /dev/null
+++ b/src/main.c
@@ -0,0 +1,35 @@
+// Copyright (c) 2010 James Buren
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to 
deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#include "exports.h"
+
+gint main(gint argc,gchar **argv) {
+  GtkWidget *window;
+
+  gtk_init(&argc,&argv);
+
+  window = window_new();
+
+  gtk_widget_show_all(window);
+
+  gtk_main();
+
+  return 0;
+}
diff --git a/src/new_action.c b/src/new_action.c
new file mode 100644
index 0000000..439184e
--- /dev/null
+++ b/src/new_action.c
@@ -0,0 +1,24 @@
+// Copyright (c) 2010 James Buren
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to 
deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#include "exports.h"
+
+void new_action(GtkToolButton *btn,SharedInfo *info) {
+}
diff --git a/src/open_action.c b/src/open_action.c
new file mode 100644
index 0000000..5f044d3
--- /dev/null
+++ b/src/open_action.c
@@ -0,0 +1,24 @@
+// Copyright (c) 2010 James Buren
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to 
deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#include "exports.h"
+
+void open_action(GtkToolButton *btn,SharedInfo *info) {
+}
diff --git a/src/save_action.c b/src/save_action.c
new file mode 100644
index 0000000..de75dd5
--- /dev/null
+++ b/src/save_action.c
@@ -0,0 +1,24 @@
+// Copyright (c) 2010 James Buren
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to 
deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#include "exports.h"
+
+void save_action(GtkToolButton *btn,SharedInfo *info) {
+}
diff --git a/src/statusbar_new.c b/src/statusbar_new.c
new file mode 100644
index 0000000..a0b7f74
--- /dev/null
+++ b/src/statusbar_new.c
@@ -0,0 +1,40 @@
+// Copyright (c) 2010 James Buren
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to 
deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#include "exports.h"
+
+GtkWidget *statusbar_new(SharedInfo *info) {
+  GtkWidget *statusbar;
+
+  statusbar = gtk_hbox_new(FALSE,4);
+
+  box_pack_widgets(statusbar,FALSE,info->action_icon = 
GTK_IMAGE(gtk_image_new_from_stock(GTK_STOCK_DISCARD,GTK_ICON_SIZE_MENU)),NULL);
+
+  box_pack_widgets(statusbar,TRUE,info->action = 
GTK_LABEL(label_new(NULL,TRUE)),NULL);
+
+  box_pack_widgets(statusbar,FALSE,label_new("Ln:",TRUE),
+                                   info->line = 
GTK_LABEL(label_new(NULL,FALSE)),
+                                   label_new("Col:",TRUE),
+                                   info->column = 
GTK_LABEL(label_new(NULL,FALSE)),
+                                   info->input = 
GTK_LABEL(label_new(NULL,TRUE)),
+                                   NULL);
+
+  return statusbar;
+}
diff --git a/src/text_widget_new.c b/src/text_widget_new.c
new file mode 100644
index 0000000..8ddc389
--- /dev/null
+++ b/src/text_widget_new.c
@@ -0,0 +1,39 @@
+// Copyright (c) 2010 James Buren
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to 
deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#include "exports.h"
+
+GtkWidget *text_widget_new(SharedInfo *info) {
+  GtkWidget *scrolled_window;
+
+  scrolled_window = gtk_scrolled_window_new(NULL,NULL);
+
+  
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window),GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC);
+
+  info->buffer = gtk_source_buffer_new(NULL);
+
+  info->view = GTK_SOURCE_VIEW(gtk_source_view_new_with_buffer(info->buffer));
+
+  gtk_container_add(GTK_CONTAINER(scrolled_window),GTK_WIDGET(info->view));
+
+  
g_signal_connect_after(info->view,"toggle-overwrite",G_CALLBACK(input_action),info);
+
+  return scrolled_window;
+}
diff --git a/src/tool_button_new.c b/src/tool_button_new.c
new file mode 100644
index 0000000..9cdc81f
--- /dev/null
+++ b/src/tool_button_new.c
@@ -0,0 +1,31 @@
+// Copyright (c) 2010 James Buren
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to 
deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#include "exports.h"
+
+GtkToolItem *tool_button_new(const gchar *stock,void (*action) (GtkToolButton 
*,SharedInfo *),SharedInfo *info) {
+  GtkToolItem *tool_button;
+
+  tool_button = gtk_tool_button_new_from_stock(stock);
+
+  g_signal_connect(tool_button,"clicked",G_CALLBACK(action),info);
+
+  return tool_button;
+}
diff --git a/src/toolbar_new.c b/src/toolbar_new.c
new file mode 100644
index 0000000..8986a70
--- /dev/null
+++ b/src/toolbar_new.c
@@ -0,0 +1,48 @@
+// Copyright (c) 2010 James Buren
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to 
deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#include "exports.h"
+
+static void toolbar_insert_items(GtkWidget *toolbar,...) {
+  va_list args;
+  GtkToolItem *item;
+
+  va_start(args,toolbar);
+
+  while((item = va_arg(args,GtkToolItem *)))
+    gtk_toolbar_insert(GTK_TOOLBAR(toolbar),item,-1);
+
+  va_end(args);
+}
+
+GtkWidget *toolbar_new(SharedInfo *info) {
+  GtkWidget *toolbar;
+
+  toolbar = gtk_toolbar_new();
+
+  toolbar_insert_items(toolbar,tool_button_new(GTK_STOCK_NEW,new_action,info),
+                               
tool_button_new(GTK_STOCK_OPEN,open_action,info),
+                               
tool_button_new(GTK_STOCK_SAVE,save_action,info),
+                               NULL);
+
+  gtk_toolbar_set_style(GTK_TOOLBAR(toolbar),GTK_TOOLBAR_ICONS);
+
+  return toolbar;
+}
diff --git a/src/window_new.c b/src/window_new.c
new file mode 100644
index 0000000..fd05bc1
--- /dev/null
+++ b/src/window_new.c
@@ -0,0 +1,42 @@
+// Copyright (c) 2010 James Buren
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to 
deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#include "exports.h"
+
+GtkWidget *window_new(void) {
+  GtkWidget *window, *vbox;
+  SharedInfo *info;
+
+  window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+
+  vbox = gtk_vbox_new(FALSE,0);
+
+  info = g_new(SharedInfo,1);
+
+  gtk_container_add(GTK_CONTAINER(window),vbox);
+
+  box_pack_widgets(vbox,FALSE,toolbar_new(info),NULL);
+
+  box_pack_widgets(vbox,TRUE,text_widget_new(info),NULL);
+
+  box_pack_widgets(vbox,FALSE,gtk_hseparator_new(),statusbar_new(info),NULL);
+
+  return window;
+}
_______________________________________________
Frugalware-git mailing list
Frugalware-git@frugalware.org
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to