Yasumichi Akahoshi
yasum****@users*****
2005年 4月 9日 (土) 15:26:22 JST
Index: cxplorer/src/interface.c diff -u cxplorer/src/interface.c:1.18 cxplorer/src/interface.c:removed --- cxplorer/src/interface.c:1.18 Mon Mar 28 22:44:30 2005 +++ cxplorer/src/interface.c Sat Apr 9 15:26:22 2005 @@ -1,242 +0,0 @@ -/** - * @file - * @brief This file contains functions which create windows. - * - * This file contains functions which create main window and about dialog. - * @author Yasumichi Akahoshi <yasum****@users*****> - * @date 2004 - * $Revision: 1.18 $ - */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <sys/types.h> -#include <sys/stat.h> -#include <unistd.h> -#include <string.h> -#include <stdio.h> - -#include <gdk/gdkkeysyms.h> -#include <gtk/gtk.h> - -#include "cxplorer.h" -#include "cxp-dir-view.h" -#include "cxp-right-pane.h" -#include "interface.h" -#include "menubar.h" -#include "toolbar.h" - -/** - * This function create main window. - * @return A instance of Cxplorer. - */ -Cxplorer *cxplorer_window_new (void) -{ - Cxplorer *cxplorer; - GtkWidget *window; - GtkWidget *vbox1; - GtkWidget *handlebox1; - GtkWidget *menubar; - GtkWidget *handlebox2; - GtkWidget *toolbar; - GtkWidget *handlebox3; - GtkWidget *hbox1; - GtkWidget *label1; - GtkWidget *hpaned1; - GtkWidget *right_pane; - GtkWidget *statusbar; - GtkAccelGroup *accel_group; - gchar *preview_dir; - gchar *preview_text; - gchar *preview_binary; - - cxplorer = cxplorer_new (); - accel_group = gtk_accel_group_new (); - - window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_window_set_title (GTK_WINDOW (window), _("Cxplorer")); - gtk_window_set_default_size (GTK_WINDOW (window), 500, 500); - - cxplorer->gwWindow = window; - - vbox1 = gtk_vbox_new (FALSE, 0); - gtk_container_add (GTK_CONTAINER (window), vbox1); - - handlebox1 = gtk_handle_box_new (); - gtk_box_pack_start (GTK_BOX (vbox1), handlebox1, FALSE, TRUE, 0); - - menubar = create_menubar (cxplorer, accel_group); - gtk_container_add (GTK_CONTAINER (handlebox1), menubar); - - handlebox2 = gtk_handle_box_new (); - gtk_box_pack_start (GTK_BOX (vbox1), handlebox2, FALSE, TRUE, 0); - - toolbar = create_toolbar (cxplorer); - gtk_container_add (GTK_CONTAINER (handlebox2), toolbar); - - handlebox3 = gtk_handle_box_new (); - gtk_box_pack_start (GTK_BOX (vbox1), handlebox3, FALSE, TRUE, 0); - - hbox1 = gtk_hbox_new (FALSE, 0); - gtk_container_add (GTK_CONTAINER (handlebox3), hbox1); - - label1 = gtk_label_new (_("Adress:")); - gtk_box_pack_start (GTK_BOX (hbox1), label1, FALSE, FALSE, 0); - gtk_label_set_justify (GTK_LABEL (label1), GTK_JUSTIFY_LEFT); - - cxplorer->gwAddressEntry = gtk_entry_new (); - gtk_entry_set_text(GTK_ENTRY(cxplorer->gwAddressEntry), cxplorer->gsCurrentPath->str); - g_signal_connect (G_OBJECT (cxplorer->gwAddressEntry), "activate", - G_CALLBACK (on_address_entry_activate), - (gpointer) cxplorer); - gtk_box_pack_start (GTK_BOX (hbox1), cxplorer->gwAddressEntry, TRUE, - TRUE, 0); - hpaned1 = gtk_hpaned_new (); - gtk_box_pack_start (GTK_BOX (vbox1), hpaned1, TRUE, TRUE, 0); - gtk_paned_set_position (GTK_PANED (hpaned1), 200); - gtk_paned_pack1 (GTK_PANED (hpaned1), GTK_WIDGET(cxplorer->dirview), FALSE, TRUE); - - right_pane = cxp_right_pane_new(); - gtk_paned_pack2 (GTK_PANED (hpaned1), right_pane, TRUE, TRUE); - g_signal_connect (G_OBJECT (right_pane), "dir_double_clicked", - G_CALLBACK (on_dir_double_clicked), - (gpointer) cxplorer); - cxplorer->right_pane = right_pane; - - /* preview commands. */ - preview_dir = cxp_profile_get_string (cxplorer->profile, "PreviewDir"); - preview_text = cxp_profile_get_string (cxplorer->profile, "PreviewText"); - preview_binary = cxp_profile_get_string (cxplorer->profile, "PreviewBinary"); - g_object_set (G_OBJECT(cxplorer->right_pane), "preview-binary", preview_binary, - "preview-dir", preview_dir, - "preview-text", preview_text, NULL); - - statusbar = gtk_statusbar_new (); - gtk_box_pack_start (GTK_BOX (vbox1), statusbar, FALSE, FALSE, 0); - g_signal_connect ((gpointer) window, - "delete_event", - G_CALLBACK - (on_window_delete_event), (gpointer) cxplorer); - g_signal_connect ((gpointer) window, - "destroy_event", - G_CALLBACK (on_window_destroy_event), NULL); - gtk_window_add_accel_group (GTK_WINDOW (window), accel_group); - return cxplorer; -} - -/** - * This function is called back when window will be requested to close. - * @param widget [in] Pointer of main window. - * @param event [in] Pointer of event - * @param user_data [in] Pointer of data which is defined by user. - * @retval TRUE This function refuse request. - * @retval FALSE This function accept request. - */ -gboolean on_window_delete_event (GtkWidget * widget, - GdkEvent * event, gpointer user_data) -{ - Cxplorer *cxplorer; - - cxplorer = (Cxplorer *) user_data; - cxp_profile_set_integer (cxplorer->profile, "ShowDotFile", - cxplorer->gbShowDotFile); - cxplorer_free (cxplorer); - gtk_main_quit (); - return FALSE; -} - -/** - * This function is called back when window is destroyed. - * @param widget [in] Pointer of window. - * @param event [in] Pointer of event. - * @param user_data [in] Pointer of data which is defined by user. - * @retval TRUE Window isn't destroyed. - * @retval FALSE Window is destroyed. - */ -gboolean on_window_destroy_event (GtkWidget * widget, - GdkEvent * event, gpointer user_data) -{ - - return FALSE; -} - -/** - * This function is called back when value of TextEntry is changed by user. - * @param gwCaller [in] GtkWidget which call this function. - * @param gpUserData [in] pointer to instance of Cxplorer. - * @todo Fixed me to process symlink. - */ -void on_address_entry_activate (GtkWidget * gwCaller, gpointer gpUserData) -{ - Cxplorer *cxplorer; - const gchar *gcAddress; - gchar *gcFullPath; - - cxplorer = (Cxplorer *) gpUserData; - gcAddress = gtk_entry_get_text (GTK_ENTRY (gwCaller)); - switch (gcAddress[0]) - { - case '/': - gcFullPath = g_strdup (gcAddress); - cxp_dir_view_change_directory (cxplorer->dirview, gcFullPath); - g_free (gcFullPath); - break; - case '.': - break; - default: - g_spawn_command_line_async (gcAddress, NULL); - break; - } -} - -/** - * This function create dialog about cxplorer. - * @return Pointer of dialog. - */ -GtkWidget *cxplorer_about_dialog_new (void) -{ - GtkWidget *AboutDialog; - GtkWidget *dialog_vbox1; - GtkWidget *vbox2; - GtkWidget *image1; - GtkWidget *VersionLabel; - GtkWidget *URLLabel; - GtkWidget *label4; - GtkWidget *dialog_action_area1; - GtkWidget *okbutton1; - - AboutDialog = gtk_dialog_new (); - gtk_window_set_title (GTK_WINDOW (AboutDialog), _("About Cxplorer")); - dialog_vbox1 = GTK_DIALOG (AboutDialog)->vbox; - gtk_widget_show (dialog_vbox1); - vbox2 = gtk_vbox_new (FALSE, 0); - gtk_widget_show (vbox2); - gtk_box_pack_start (GTK_BOX (dialog_vbox1), vbox2, TRUE, TRUE, 0); - image1 = create_pixmap (AboutDialog, "cxplorer.png"); - gtk_widget_show (image1); - gtk_box_pack_start (GTK_BOX (vbox2), image1, FALSE, FALSE, 0); - VersionLabel = gtk_label_new (g_strdup_printf ("Version %s", VERSION)); - gtk_box_pack_start (GTK_BOX (vbox2), VersionLabel, TRUE, FALSE, 0); - gtk_label_set_justify (GTK_LABEL (VersionLabel), GTK_JUSTIFY_LEFT); - gtk_widget_show (VersionLabel); - URLLabel = gtk_label_new (_("http://cxplorer.sourceforge.jp/")); - gtk_box_pack_start (GTK_BOX (vbox2), URLLabel, TRUE, FALSE, 0); - gtk_label_set_justify (GTK_LABEL (URLLabel), GTK_JUSTIFY_LEFT); - gtk_widget_show (URLLabel); - label4 = gtk_label_new (_("Copyright 2003-2004 Cxplorer Project")); - gtk_box_pack_start (GTK_BOX (vbox2), label4, TRUE, FALSE, 0); - gtk_label_set_justify (GTK_LABEL (label4), GTK_JUSTIFY_LEFT); - gtk_widget_show (label4); - dialog_action_area1 = GTK_DIALOG (AboutDialog)->action_area; - gtk_button_box_set_layout (GTK_BUTTON_BOX - (dialog_action_area1), GTK_BUTTONBOX_END); - gtk_widget_show (dialog_action_area1); - okbutton1 = gtk_button_new_from_stock ("gtk-ok"); - gtk_dialog_add_action_widget (GTK_DIALOG (AboutDialog), - okbutton1, GTK_RESPONSE_OK); - GTK_WIDGET_SET_FLAGS (okbutton1, GTK_CAN_DEFAULT); - gtk_widget_show (okbutton1); - return AboutDialog; -} Index: cxplorer/src/interface.h diff -u cxplorer/src/interface.h:1.5 cxplorer/src/interface.h:removed --- cxplorer/src/interface.h:1.5 Mon Nov 8 22:52:16 2004 +++ cxplorer/src/interface.h Sat Apr 9 15:26:22 2005 @@ -1,32 +0,0 @@ -/** - * @file - * @brief This file define prototypes of interface.c. - * - * @author Yasumichi Akahoshi <yasum****@users*****> - * @date Wed Jun 9 00:26:54 2004 - * $Revision: 1.5 $ - */ - - -#ifndef _INTERFACE_H -#define _INTERFACE_H - -#ifdef __cplusplus -extern "C" -{ -#endif - - Cxplorer *cxplorer_window_new (void); - gboolean on_window_delete_event (GtkWidget * widget, - GdkEvent * event, gpointer user_data); - void on_address_entry_activate (GtkWidget * gwCaller, - gpointer gpUserData); - gboolean on_window_destroy_event (GtkWidget * widget, GdkEvent * event, - gpointer user_data); - GtkWidget *cxplorer_about_dialog_new (void); - -#ifdef __cplusplus -} -#endif - -#endif /* _INTERFACE_H */