Commit ca310605 authored by Victor Ananjevsky's avatar Victor Ananjevsky

working commit

parent f01bbc5b
...@@ -27,6 +27,7 @@ yad_SOURCES = \ ...@@ -27,6 +27,7 @@ yad_SOURCES = \
util.c \ util.c \
main.c \ main.c \
yad.h \ yad.h \
stock.h \
calendar.xpm calendar.xpm
if HTML if HTML
......
...@@ -64,13 +64,8 @@ load_uri (const gchar * uri) ...@@ -64,13 +64,8 @@ load_uri (const gchar * uri)
addr = g_strdup (uri); addr = g_strdup (uri);
} }
if (addr) webkit_web_view_load_uri (view, addr);
{ g_free (addr);
webkit_web_view_load_uri (view, addr);
g_free (addr);
}
else
g_printerr ("yad_html_load_uri: cannot load uri '%s'\n", uri);
} }
static void static void
...@@ -105,7 +100,7 @@ policy_cb (WebKitWebView *v, WebKitPolicyDecision *pd, WebKitPolicyDecisionType ...@@ -105,7 +100,7 @@ policy_cb (WebKitWebView *v, WebKitPolicyDecision *pd, WebKitPolicyDecisionType
} }
static void static void
select_file_cb (GtkEntry * entry, GtkEntryIconPosition pos, GdkEventButton * ev, gpointer d) select_file_cb (GtkEntry *entry, GtkEntryIconPosition pos, GdkEventButton *ev, gpointer d)
{ {
GtkWidget *dlg; GtkWidget *dlg;
static gchar *dir = NULL; static gchar *dir = NULL;
...@@ -116,7 +111,9 @@ select_file_cb (GtkEntry * entry, GtkEntryIconPosition pos, GdkEventButton * ev, ...@@ -116,7 +111,9 @@ select_file_cb (GtkEntry * entry, GtkEntryIconPosition pos, GdkEventButton * ev,
dlg = gtk_file_chooser_dialog_new (_("YAD - Select File"), dlg = gtk_file_chooser_dialog_new (_("YAD - Select File"),
GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (entry))), GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (entry))),
GTK_FILE_CHOOSER_ACTION_OPEN, GTK_FILE_CHOOSER_ACTION_OPEN,
GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, NULL); _("OK"), GTK_RESPONSE_ACCEPT,
_("Cancel"), GTK_RESPONSE_CANCEL,
NULL);
if (dir) if (dir)
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dlg), dir); gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dlg), dir);
...@@ -135,20 +132,22 @@ select_file_cb (GtkEntry * entry, GtkEntryIconPosition pos, GdkEventButton * ev, ...@@ -135,20 +132,22 @@ select_file_cb (GtkEntry * entry, GtkEntryIconPosition pos, GdkEventButton * ev,
} }
static void static void
do_open_cb (GtkWidget * w, GtkDialog * dlg) do_open_cb (GtkWidget *w, GtkDialog *dlg)
{ {
gtk_dialog_response (dlg, GTK_RESPONSE_ACCEPT); gtk_dialog_response (dlg, GTK_RESPONSE_ACCEPT);
} }
static void static void
open_cb (GtkWidget * w, gpointer d) open_cb (GtkWidget *w, gpointer d)
{ {
GtkWidget *dlg, *cnt, *lbl, *entry; GtkWidget *dlg, *cnt, *lbl, *entry;
dlg = gtk_dialog_new_with_buttons (_("Open URI"), dlg = gtk_dialog_new_with_buttons (_("Open URI"),
GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (view))), GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (view))),
GTK_DIALOG_DESTROY_WITH_PARENT, GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL); _("Cancel"), GTK_RESPONSE_REJECT,
_("Open"), GTK_RESPONSE_ACCEPT,
NULL);
gtk_window_set_default_size (GTK_WINDOW (dlg), 350, -1); gtk_window_set_default_size (GTK_WINDOW (dlg), 350, -1);
cnt = gtk_dialog_get_content_area (GTK_DIALOG (dlg)); cnt = gtk_dialog_get_content_area (GTK_DIALOG (dlg));
...@@ -173,10 +172,10 @@ open_cb (GtkWidget * w, gpointer d) ...@@ -173,10 +172,10 @@ open_cb (GtkWidget * w, gpointer d)
} }
static gboolean static gboolean
menu_cb (WebKitWebView * view, GtkWidget * menu, WebKitHitTestResult * hit, gboolean kb, gpointer d) menu_cb (WebKitWebView *view, GtkWidget *menu, WebKitHitTestResult *hit, gboolean kb, gpointer d)
{ {
GtkWidget *mi; GtkWidget *mi;
/* FIXME: add custom menu items here */ /* FIXME: add custom menu items here */
return FALSE; return FALSE;
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include <sys/shm.h> #include <sys/shm.h>
#include "yad.h" #include "yad.h"
#include "stock.h"
YadSettings settings; YadSettings settings;
...@@ -113,8 +114,7 @@ write_settings (void) ...@@ -113,8 +114,7 @@ write_settings (void)
g_key_file_set_integer (kf, "General", "timeout", settings.timeout); g_key_file_set_integer (kf, "General", "timeout", settings.timeout);
g_key_file_set_comment (kf, "General", "timeout", " Default timeout (0 for no timeout)", NULL); g_key_file_set_comment (kf, "General", "timeout", " Default timeout (0 for no timeout)", NULL);
g_key_file_set_string (kf, "General", "timeout_indicator", settings.to_indicator); g_key_file_set_string (kf, "General", "timeout_indicator", settings.to_indicator);
g_key_file_set_comment (kf, "General", "timeout_indicator", g_key_file_set_comment (kf, "General", "timeout_indicator", " Position of timeout indicator (top, bottom, left, right, none)", NULL);
" Position of timeout indicator (top, bottom, left, right, none)", NULL);
g_key_file_set_boolean (kf, "General", "show_remain", settings.show_remain); g_key_file_set_boolean (kf, "General", "show_remain", settings.show_remain);
g_key_file_set_comment (kf, "General", "show_remain", " Show remain seconds in timeout indicator", NULL); g_key_file_set_comment (kf, "General", "show_remain", " Show remain seconds in timeout indicator", NULL);
g_key_file_set_boolean (kf, "General", "combo_always_editable", settings.combo_always_editable); g_key_file_set_boolean (kf, "General", "combo_always_editable", settings.combo_always_editable);
...@@ -151,6 +151,12 @@ write_settings (void) ...@@ -151,6 +151,12 @@ write_settings (void)
g_free (context); g_free (context);
} }
static gboolean
stock_lookup (gchar *key, YadStock *it)
{
return FALSE;
}
GdkPixbuf * GdkPixbuf *
get_pixbuf (gchar * name, YadIconSize size, gboolean force) get_pixbuf (gchar * name, YadIconSize size, gboolean force)
{ {
...@@ -359,8 +365,8 @@ get_tabs (key_t key, gboolean create) ...@@ -359,8 +365,8 @@ get_tabs (key_t key, gboolean create)
GtkWidget * GtkWidget *
get_label (gchar * str, guint border) get_label (gchar * str, guint border)
{ {
GtkWidget *a, *t, *i, *l; GtkWidget *t, *i, *l;
GtkStockItem it; YadStock it;
gchar **vals; gchar **vals;
if (!str || !*str) if (!str || !*str)
...@@ -368,17 +374,14 @@ get_label (gchar * str, guint border) ...@@ -368,17 +374,14 @@ get_label (gchar * str, guint border)
l = i = NULL; l = i = NULL;
a = gtk_alignment_new (0.5, 0.5, 0, 0);
gtk_container_set_border_width (GTK_CONTAINER (a), border);
t = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); t = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_container_add (GTK_CONTAINER (a), t); gtk_container_set_border_width (GTK_CONTAINER (t), border);
vals = g_strsplit_set (str, options.common_data.item_separator, 3); vals = g_strsplit_set (str, options.common_data.item_separator, 3);
if (gtk_stock_lookup (vals[0], &it)) if (stock_lookup (vals[0], &it))
{ {
l = gtk_label_new_with_mnemonic (it.label); l = gtk_label_new_with_mnemonic (it.label);
i = gtk_image_new_from_pixbuf (get_pixbuf (it.stock_id, YAD_SMALL_ICON, TRUE)); i = gtk_image_new_from_pixbuf (get_pixbuf (it.icon, YAD_SMALL_ICON, TRUE));
} }
else else
{ {
...@@ -396,7 +399,8 @@ get_label (gchar * str, guint border) ...@@ -396,7 +399,8 @@ get_label (gchar * str, guint border)
} }
if (i) if (i)
gtk_box_pack_start (GTK_BOX (t), i, FALSE, FALSE, 1); gtk_container_add (GTK_CONTAINER (t), i);
if (l) if (l)
{ {
gtk_label_set_xalign (GTK_LABEL (l), 0.0); gtk_label_set_xalign (GTK_LABEL (l), 0.0);
...@@ -414,9 +418,9 @@ get_label (gchar * str, guint border) ...@@ -414,9 +418,9 @@ get_label (gchar * str, guint border)
g_strfreev (vals); g_strfreev (vals);
gtk_widget_show_all (a); gtk_widget_show_all (t);
return a; return t;
} }
gchar * gchar *
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment