Added:
/glade-helper.c
Modified:
/Makefile
/glade.c
/shacrypt.glade
=======================================
--- /dev/null
+++ /glade-helper.c Sat Nov 14 08:05:57 2009
@@ -0,0 +1,66 @@
+/**
+ * SHACrypt graphical user interface (compile-time helper)
+ *
+ * SHACrypt - Encrypt files using cryptographic hash functions
+ * Copyright (C) 2009 LlamaSlayers
+ *
+ * This program 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 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @since 1.2.1
+ * @version 1.2.1
+ */
+#include <stdio.h>
+#include <stdlib.h>
+
+int main( int argc, char** argv ) {
+ FILE* glade;
+ FILE* out;
+
+ glade = fopen( "shacrypt.glade", "r" );
+
+ if ( !glade ) {
+ perror( "Could not open glade file" );
+ exit( 1 );
+ }
+
+ out = fopen( "glade.h", "w" );
+
+ if ( !out ) {
+ perror( "Could not open header file" );
+ exit( 1 );
+ }
+
+ fwrite( "#ifndef _SHACRYPT_GLADE_H_\n#define _SHACRYPT_GLADE_H_\nconst
char* shacrypt_glade = \"", 1, 84, out );
+
+ int c;
+
+ while ( 1 ) {
+ c = fgetc( glade );
+
+ if ( c == EOF )
+ break;
+ if ( c == '\n' || c == '\r' ) {
+ fwrite( "\\n", 1, 2, out );
+ continue;
+ }
+ if ( c == '"' || c == '\\' )
+ fputc( '\\', out );
+
+ fputc( c, out );
+ }
+
+ fwrite( "\";\n#endif\n", 1, 10, out );
+
+ return 0;
+}
=======================================
--- /Makefile Tue Nov 10 14:06:36 2009
+++ /Makefile Sat Nov 14 08:05:57 2009
@@ -15,7 +15,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
objects=shacrypt.o third-party/sha1.o third-party/sha2.o
third-party/md5c.o third-party/cubehash.o third-party/whirlpool.o
-secondaryobjects=commandline.o shacrypt shacrypt.exe glade.o shacrypt-gtk
shacrypt-gtk.exe tests.o tests tests.exe
+secondaryobjects=commandline.o shacrypt shacrypt.exe glade.o shacrypt-gtk
shacrypt-gtk.exe tests.o tests tests.exe glade.h glade-helper.o
glade-helper glade-helper.exe
ifndef CFLAGS
CFLAGS=-O2 -Wall -g -fomit-frame-pointer
@@ -28,9 +28,13 @@
build: commandline.o $(objects)
$(CC) $(CFLAGS) -o shacrypt commandline.o $(objects)
-build-gtk: glade.o $(objects)
+build-gtk: glade.h glade.o $(objects)
$(CC) $(CFLAGS) -o shacrypt-gtk glade.o $(objects) `pkg-config --cflags
--libs gtk+-2.0 gmodule-2.0 gthread-2.0`
+glade.h: glade-helper.o shacrypt.glade
+ $(CC) $(CFLAGS) -o glade-helper glade-helper.o
+ ./glade-helper
+
# Hash algorithms
third-party/sha1.o: third-party/sha1.h
third-party/sha2.o: third-party/sha2.h
@@ -46,7 +50,7 @@
glade.o: glade.c shacrypt.h
# This is a horrible, hackish way to do this, but at least it gets the
job done.
$(CC) $(CFLAGS) -c -o glade.o glade.c `pkg-config --cflags gtk+-2.0
gmodule-2.0 gthread-2.0`
-
+glade-helper.o: glade-helper.c
install: build
cp -t $(DESTDIR) shacrypt
=======================================
--- /glade.c Tue Nov 10 14:06:36 2009
+++ /glade.c Sat Nov 14 08:05:57 2009
@@ -25,6 +25,7 @@
#include <stdio.h>
#include <string.h>
#include "shacrypt.h"
+#include "glade.h"
static const char identifier[3] = "\xA7\x09\xC3";
@@ -745,7 +746,7 @@
builder = gtk_builder_new();
- if( !gtk_builder_add_from_file( builder, "shacrypt.glade", &error ) ) {
+ if( !gtk_builder_add_from_string( builder, shacrypt_glade, -1, &error
) ) {
g_warning( "%s", error->message );
g_free( error );
return 1;
=======================================
--- /shacrypt.glade Mon Nov 9 19:03:37 2009
+++ /shacrypt.glade Sat Nov 14 08:05:57 2009
@@ -682,9 +682,9 @@
<object class="GtkFileChooserWidget" id="file_d1_select">
<property name="visible">True</property>
<property name="orientation">vertical</property>
- <property name="use_preview_label">False</property>
<property name="preview_widget_active">False</property>
<property name="filter">filter_shacrypt_ext</property>
+ <property name="use_preview_label">False</property>
<signal name="file_activated" handler="decrypt_step1_ok"/>
</object>
<packing>
@@ -947,6 +947,287 @@
<property name="position">1</property>
</packing>
</child>
+ </object>
+ </child>
+ </object>
+ <object class="GtkDialog" id="asymmetric_step1">
+ <property name="border_width">5</property>
+ <property name="title" translatable="yes">Asymmetric Encryption (Step
1 of 3)</property>
+ <property name="modal">True</property>
+ <property name="window_position">center-on-parent</property>
+ <property name="type_hint">dialog</property>
+ <property name="transient_for">main</property>
+ <property name="has_separator">False</property>
+ <signal name="delete_event" handler="gtk_widget_hide_on_delete"/>
+ <child internal-child="vbox">
+ <object class="GtkVBox" id="dialog-vbox9">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">2</property>
+ <child>
+ <object class="GtkFileChooserWidget" id="file_a1_select">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="preview_widget_active">False</property>
+ <property name="filter">filter_shacrypt_ext</property>
+ <property name="use_preview_label">False</property>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child internal-child="action_area">
+ <object class="GtkHButtonBox" id="dialog-action_area9">
+ <property name="visible">True</property>
+ <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton" id="button_a1_cancel">
+ <property name="label">gtk-cancel</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ <signal name="clicked" handler="asymmetric_step1_cancel"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button_a1_ok">
+ <property name="label">gtk-ok</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ <signal name="clicked" handler="asymmetric_step1_ok"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="0">button_a1_cancel</action-widget>
+ <action-widget response="0">button_a1_ok</action-widget>
+ </action-widgets>
+ </object>
+ <object class="GtkDialog" id="asymmetric_step2">
+ <property name="border_width">5</property>
+ <property name="title" translatable="yes">Asymmetric Encryption (Step
2 of 3)</property>
+ <property name="modal">True</property>
+ <property name="window_position">center-on-parent</property>
+ <property name="type_hint">dialog</property>
+ <property name="transient_for">asymmetric_step1</property>
+ <property name="has_separator">False</property>
+ <signal name="delete_event" handler="asymmetric_step2_cancel"/>
+ <signal name="delete_event" handler="gtk_widget_hide_on_delete"/>
+ <child internal-child="vbox">
+ <object class="GtkVBox" id="dialog-vbox2">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">2</property>
+ <child>
+ <object class="GtkNotebook" id="notebook_a2_tabs">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <child>
+ <object class="GtkVBox" id="vbox7">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkTable" id="table3">
+ <property name="visible">True</property>
+ <property name="n_rows">2</property>
+ <property name="n_columns">2</property>
+ <child>
+ <object class="GtkEntry" id="field_a2_password1">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="visibility">False</property>
+ <property name="invisible_char">●</property>
+ <property name="activates_default">True</property>
+ <property name="invisible_char_set">True</property>
+ <signal name="changed"
handler="asymmetric_step2_passchange"/>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label_a2_password2">
+ <property name="visible">True</property>
+ <property name="xpad">5</property>
+ <property name="ypad">5</property>
+ <property name="label"
translatable="yes">(again)</property>
+ </object>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="y_options">GTK_SHRINK</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="field_a2_password2">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="visibility">False</property>
+ <property name="invisible_char">●</property>
+ <property name="invisible_char_set">True</property>
+ <signal name="changed"
handler="asymmetric_step2_passchange"/>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label_a2_password1">
+ <property name="visible">True</property>
+ <property name="xpad">5</property>
+ <property name="ypad">5</property>
+ <property name="label"
translatable="yes">Password</property>
+ </object>
+ <packing>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="padding">2</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkProgressBar"
id="progressbar_a2_pass_strength">
+ <property name="visible">True</property>
+ <property name="show_text">True</property>
+ <property name="text" translatable="yes">Enter a
password</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <child type="tab">
+ <object class="GtkLabel" id="label_a2_basic">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Basic</property>
+ </object>
+ <packing>
+ <property name="tab_fill">False</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child internal-child="action_area">
+ <object class="GtkHButtonBox" id="dialog-action_area2">
+ <property name="visible">True</property>
+ <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton" id="button_e2_cancel1">
+ <property name="label">gtk-cancel</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ <signal name="clicked" handler="asymmetric_step2_cancel"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button_a2_ok">
+ <property name="label">gtk-ok</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="has_default">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ <accelerator key="Return" signal="clicked"/>
+ <signal name="clicked" handler="asymmetric_step2_ok"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="0">button_e2_cancel1</action-widget>
+ <action-widget response="0">button_a2_ok</action-widget>
+ </action-widgets>
+ </object>
+ <object class="GtkWindow" id="asymmetric_step3">
+ <property name="border_width">5</property>
+ <property name="title" translatable="yes">Asymmetric Encryption (Step
3 of 3)</property>
+ <property name="modal">True</property>
+ <property name="window_position">center-on-parent</property>
+ <property name="type_hint">dialog</property>
+ <property name="deletable">False</property>
+ <property name="transient_for">asymmetric_step2</property>
+ <child>
+ <object class="GtkVBox" id="vbox8">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">5</property>
+ <child>
+ <object class="GtkProgressBar" id="progressbar_a3_progress">
+ <property name="visible">True</property>
+ <property name="show_text">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label_a3_description">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Your file is now
being encrypted using the password you specified. A copy has been created,
so the original file will not be modified.</property>
+ <property name="justify">center</property>
+ <property name="wrap">True</property>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
</object>
</child>
</object>