Yattm - unified GTK instant-messaging client logo
   [Generated for version 0.2-17 - Mon Jan 6 19:01:23 GMT+1 2003]

Home - Main Page - Data Structures - File List - Data Fields - Globals

browser.h File Reference

#include <gtk/gtk.h>

Include dependency graph for browser.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Functions

void open_url (GtkWidget *w, char *url)
void open_url_nw (GtkWidget *w, char *url)


Function Documentation

void open_url GtkWidget *    w,
char *    url
 

Definition at line 550 of file browser.c.

References BROWSER_KFM, BROWSER_NETSCAPE, netscape_command(), and web_browser.

00550                                        {
00551     if (web_browser == BROWSER_NETSCAPE) {
00552                 char *command = g_malloc(1024);
00553 
00554         g_snprintf(command, 1024, "OpenURL(%s)", url);
00555 
00556         netscape_command(command);
00557         g_free(command);
00558     } else if (web_browser == BROWSER_KFM) {
00559         pid_t pid;
00560 
00561         pid = fork();
00562 
00563         if (pid == 0) {
00564             char *args[4];
00565 
00566             args[0] = g_strdup("kfmclient");
00567             args[1] = g_strdup("openURL");
00568                         args[2] = url;;
00569             args[3] = NULL;
00570 
00571             execvp(args[0], args);
00572             _exit(0);
00573         } else {
00574             gtk_timeout_add(1000, (GtkFunction)clean_pid, NULL);
00575         }
00576     }  
00577 }

void open_url_nw GtkWidget *    w,
char *    url
 

Definition at line 590 of file browser.c.

References BROWSER_NETSCAPE, cGetLocalPref(), DBG_CORE, eb_debug, netscape_command(), and web_browser.

Referenced by handle_click(), show_manual(), and show_website().

00590                                           {
00591     char *alternate_browser=cGetLocalPref("alternate_browser");
00592     if ((use_alternate_browser == 1) && (strlen(alternate_browser) > 0)) {
00593         char *command = g_malloc(1024);
00594         char *url_pos = strstr(alternate_browser, "%s");
00595         /*
00596          * if alternate_browser contains a %s, then we put
00597          * the url in place of the %s, else, put the url
00598          * at the end.
00599          */
00600         if(url_pos) {
00601             int pre_len = url_pos-alternate_browser;
00602             strncpy(command, alternate_browser, pre_len);
00603             command[pre_len] = 0;
00604             strncat(command, url, 1024 - pre_len);
00605             strncat(command, url_pos+2, 1024 - strlen(command));
00606             strncat(command, " &", 1024 - strlen(command));
00607         } else
00608             g_snprintf(command, 1024, "%s \"%s\" &", alternate_browser, url);
00609         eb_debug(DBG_CORE, "launching %s\n", command);
00610         system(command);
00611         g_free(command);
00612     } else if (web_browser == BROWSER_NETSCAPE) {
00613         char *command = g_malloc(1024);
00614         g_snprintf(command, 1024, "OpenURL(%s, new-window)", url);
00615 
00616         netscape_command(command);
00617         g_free(command);
00618     }
00619 }


Contact: Andy Maloney     [Documentation generated by doxygen]