summary refs log blame commit diff stats
path: root/doc/pydoc/ranger.ext.html
blob: d58c1b87b0cea55c16c24dc1d1126357ab6d91a5 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
 

                                                              






                                                                                                                                                                           
                                                                                                                                                                                                   








                                                                                                                                            
                                                               
                                                                                   

                                                                                                 
                                                               
                                                       

                                                                           
                                                       
                                                           
                                                                           
                                                                                                 

                                    
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: package ranger.ext</title>
</head><body bgcolor="#f0f0f8">

<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial">&nbsp;<br><big><big><strong><a href="ranger.html"><font color="#ffffff">ranger</font></a>.ext</strong></big></big></font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/home/hut/ranger/ranger/ext/__init__.py">/home/hut/ranger/ranger/ext/__init__.py</a></font></td></tr></table>
    <p><tt>This&nbsp;package&nbsp;includes&nbsp;extensions&nbsp;with&nbsp;broader&nbsp;usability</tt></p>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#aa55cc">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Package Contents</strong></big></font></td></tr>
    
<tr><td bgcolor="#aa55cc"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="ranger.ext.accumulator.html">accumulator</a><br>
<a href="ranger.ext.command_parser.html">command_parser</a><br>
<a href="ranger.ext.curses_interrupt_handler.html">curses_interrupt_handler</a><br>
<a href="ranger.ext.get_all_modules.html">get_all_modules</a><br>
</td><td width="25%" valign=top><a href="ranger.ext.get_executables.html">get_executables</a><br>
<a href="ranger.ext.human_readable.html">human_readable</a><br>
<a href="ranger.ext.iter_tools.html">iter_tools</a><br>
<a href="ranger.ext.mount_path.html">mount_path</a><br>
</td><td width="25%" valign=top><a href="ranger.ext.move.html">move</a><br>
<a href="ranger.ext.openstruct.html">openstruct</a><br>
<a href="ranger.ext.shell_escape.html">shell_escape</a><br>
<a href="ranger.ext.shutil_generatorized.html">shutil_generatorized</a><br>
</td><td width="25%" valign=top><a href="ranger.ext.waitpid_no_intr.html">waitpid_no_intr</a><br>
</td></tr></table></td></tr></table>
</body></html>
w"> int (*func)(struct karg *); struct karg arg; } keys[] = { { GDK_CONTROL_MASK, 0, GDK_q, quit, {0} } }; void activate_uri_entry_cb(GtkWidget* entry, gpointer data) { gchar *uri = gtk_entry_get_text(GTK_ENTRY(entry)); g_assert(uri); webkit_web_view_load_uri(wv, uri); } void notify_load_status_cb(WebKitWebView* wview, GParamSpec* pspec, gpointer data) { WebKitWebFrame *frame; gchar *uri; if (webkit_web_view_get_load_status(wview) == WEBKIT_LOAD_COMMITTED) { frame = webkit_web_view_get_main_frame(wview); uri = webkit_web_frame_get_uri(frame); if (uri) gtk_entry_set_text(GTK_ENTRY(uri_entry), uri); } } void webview_keypress_cb(WebKitWebView *webview, GdkEventKey *e) { int i; for (i = 0; i < LENGTH(keys); i++) if (e->keyval == keys[i].key && CLEAN(e->state) == keys[i].mask) keys[i].func(&keys[i].arg); } GtkWidget * create_browser(void) { GtkWidget *w; w = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(w), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); wv = WEBKIT_WEB_VIEW(webkit_web_view_new()); gtk_container_add(GTK_CONTAINER(w), GTK_WIDGET(wv)); g_signal_connect(wv, "notify::load-status", G_CALLBACK(notify_load_status_cb), wv); return (w); } GtkWidget * create_window(void) { GtkWidget *w; w = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_default_size(GTK_WINDOW(w), 800, 600); gtk_widget_set_name(w, "xxxterm"); return (w); } GtkWidget * create_toolbar(void) { GtkWidget *toolbar = gtk_toolbar_new(); GtkToolItem *i; #if GTK_CHECK_VERSION(2,15,0) gtk_orientable_set_orientation(GTK_ORIENTABLE(toolbar), GTK_ORIENTATION_HORIZONTAL); #else gtk_toolbar_set_orientation(GTK_TOOLBAR(toolbar), GTK_ORIENTATION_HORIZONTAL); #endif gtk_toolbar_set_style(GTK_TOOLBAR(toolbar), GTK_TOOLBAR_BOTH_HORIZ); i = gtk_tool_item_new(); gtk_tool_item_set_expand(i, TRUE); uri_entry = gtk_entry_new(); gtk_container_add(GTK_CONTAINER(i), uri_entry); g_signal_connect(G_OBJECT(uri_entry), "activate", G_CALLBACK(activate_uri_entry_cb), NULL); gtk_toolbar_insert(GTK_TOOLBAR(toolbar), i, -1); tb = toolbar; return (toolbar); } void gui(void) { GtkWidget *vbox; vbox = gtk_vbox_new(FALSE, 0); gtk_box_pack_end(GTK_BOX(vbox), create_toolbar(), FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), create_browser(), TRUE, TRUE, 0); mw = create_window(); gtk_container_add(GTK_CONTAINER(mw), vbox); g_object_connect((GObject*)wv, "signal::key-press-event", (GCallback)webview_keypress_cb, NULL, NULL); webkit_web_view_load_uri(wv, "http://www.peereboom.us/"); gtk_widget_grab_focus(GTK_WIDGET(wv)); gtk_widget_show_all(mw); } int main(int argc, char *argv[]) { /* prepare gtk */ gtk_init(&argc, &argv); if (!g_thread_supported()) g_thread_init(NULL); gui(); //gtk_widget_hide(tb); gtk_main(); return (0); }