JNIEXPORT void JNICALL Java_org_gnome_gdk_GdkWindow_gdk_1window_1set_1icon_1name ( JNIEnv* env, jclass cls, jlong _self, jstring _name ) { GdkWindow* self; const gchar* name; // convert parameter self self = (GdkWindow*) _self; // convert parameter name name = (const gchar*) bindings_java_getString(env, _name); if (name == NULL) { return; // Java Exception already thrown } // call function gdk_window_set_icon_name(self, name); // cleanup parameter self // cleanup parameter name bindings_java_releaseString(name); }
static void set_icon_bitmap(GtkWidget *w) { GdkPixmap *icon_pixmap; gdk_window_set_icon_name(w->window, APPNAME); icon_pixmap = gdk_bitmap_create_from_data( w->window, np2_bits, np2_width, np2_height); gdk_window_set_icon(w->window, NULL, icon_pixmap, NULL); }
static void set_icon_pixmap(GtkWidget *window, gchar **bits) { GdkPixmap *pixmap; GdkBitmap *mask; GtkStyle *style; style = gtk_widget_get_style(window); pixmap = gdk_pixmap_create_from_xpm_d(window->window, &mask, &style->bg[GTK_STATE_NORMAL], bits); gdk_window_set_icon(window->window, NULL, pixmap, mask); gdk_window_set_icon_name(window->window, "TiMidity"); }
void wins_set_icon (GtkWidget *win) { #ifdef USE_XLIB GdkAtom icon_atom; glong data[2]; gtk_widget_realize (win); data[0] = GDK_WINDOW_XWINDOW (pix_xchat_mini); data[1] = GDK_WINDOW_XWINDOW (mask_xchat_mini); icon_atom = gdk_atom_intern ("KWM_WIN_ICON", FALSE); gdk_property_change (win->window, icon_atom, icon_atom, 32, GDK_PROP_MODE_REPLACE, (guchar *) data, 2); gdk_window_set_icon (win->window, NULL, pix_xchat, mask_xchat); gdk_window_set_icon_name (win->window, PACKAGE); #endif }
// Set ICON NAME property for window int clip_GTK_WINDOWSETICONNAME(ClipMachine * cm) { C_widget *cwin = _fetch_cw_arg(cm); gchar *name = _clip_parc(cm, 2); CHECKARG(2,CHARACTER_t); CHECKCWID(cwin,GTK_IS_WINDOW); if (cwin->widget->window) { LOCALE_TO_UTF(name); gdk_window_set_icon_name(cwin->widget->window, name); FREE_TEXT(name); _clip_retl(cm, TRUE); } else _clip_retl(cm, FALSE); return 0; err: return 1; }
static VALUE gdkwin_set_icon_name(VALUE self, VALUE name) { gdk_window_set_icon_name(_SELF(self), RVAL2CSTR(name)); return self; }
int main(int argc, char *argv[]) { GdkPixbuf *icon; /* Redirect standard output to a file - printing to the Windows terminal slows operation down way too much */ #ifdef __WIN32__ gchar *tmp; FILE *log_file; tmp = g_strconcat(g_get_home_dir(), G_DIR_SEPARATOR_S, LOG_FILE, NULL); log_file = g_fopen(tmp, "wt"); g_free(tmp); if (log_file != NULL) g_log_set_default_handler(&default_log_handler, log_file); #endif // Force GLib 2.32+ to print info and debug messages like older versions did, unless this variable is already set. // No effect on earlier GLib versions. g_setenv("G_MESSAGES_DEBUG", "all", /* overwrite = */ FALSE); /* Init the tilp core */ tilp_init(&argc, &argv); /* Init GTK+ */ gtk_init(&argc, &argv); add_pixmap_directory(inst_paths.pixmap_dir); add_pixmap_directory(inst_paths.icon_dir); splash_screen_start(); /* Get rid of glib, gdk, gtk warnings when compiled in Release mode */ #if !defined(_DEBUG) g_log_set_handler ("GLib", G_LOG_LEVEL_WARNING | G_LOG_LEVEL_MESSAGE | G_LOG_LEVEL_INFO | G_LOG_LEVEL_DEBUG, my_blackhole_log_handler, NULL); g_log_set_handler ("Gdk", G_LOG_LEVEL_WARNING | G_LOG_LEVEL_MESSAGE | G_LOG_LEVEL_INFO | G_LOG_LEVEL_DEBUG, my_blackhole_log_handler, NULL); g_log_set_handler ("Gtk", G_LOG_LEVEL_WARNING | G_LOG_LEVEL_MESSAGE | G_LOG_LEVEL_INFO | G_LOG_LEVEL_DEBUG, my_blackhole_log_handler, NULL); g_log_set_handler ("GLib", G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION, my_blackhole_log_handler, NULL); #endif /* Init the GUI-independent functions */ tilp_gif_set_gtk(); tilp_update_set_gtk(); /* Create the main window */ if(!(working_mode & MODE_CMD)) { #if WITH_KDE splash_screen_set_label(_("Initializing KDE...")); sp_kde_init(argc, argv, "tilp", _("TiLP"), VERSION, _("Tilp Is a Linking Program"), "Copyright (c) 1999-2008 Romain Lievin", "http://lpg.ticalc.org/prj_tilp/", "*****@*****.**"); atexit(sp_kde_finish); // Not needed unless we want to add a DCOP interface. // g_timeout_add(26, sp_kde_process_qt_events, NULL); #endif splash_screen_set_label(_("Loading GUI...")); main_wnd = display_tilp_dbox(); } /* Do a local directory list */ g_free(local.cwdir); local.cwdir = g_get_current_dir(); /* Update the local view (not visible yet) */ if(!(working_mode & MODE_CMD)) { clist_refresh(); labels_refresh(); } /* Inits are done ! */ working_mode &= ~MODE_INI; tilp_err(0); // pop errors (display console mode) /* In cmdline, does not display the entire window, only the pbar */ if(!(working_mode & MODE_CMD)) { gtk_widget_show(main_wnd); toolbar_refresh_buttons(); icon = create_pixbuf("tilp.xpm"); gtk_window_set_icon(GTK_WINDOW(main_wnd), icon); gdk_window_set_icon_name(main_wnd->window, _("TiLP2")); } /* If variables have been passed on the command line in GUI mode then send them */ if((working_mode & MODE_GUI) && (working_mode & MODE_CMD)) { splash_screen_set_label(_("Command line...")); if(local.selection0 || local.selection2 || local.selection5) on_tilp_send(""); else if(local.selection4) tilp_cmdline_send(); } /* GTK main loop */ splash_screen_stop(); if(!(working_mode & MODE_CMD)) gtk_main(); tilp_exit(); return 0; }
void about_dialog (gpointer data) { GtkWidget * tempwid, * notebook, * box, * label, * view, * vscroll, * dialog; char *tempstr, *temp1str, *no_license_agreement, *str, buf[255], *share_dir; size_t len; FILE * fd; #if GTK_MAJOR_VERSION > 1 GtkTextBuffer * textbuf; GtkTextIter iter; gint textlen; #endif share_dir = gftp_get_share_dir (); no_license_agreement = g_strdup_printf (_("Cannot find the license agreement file COPYING. Please make sure it is in either %s or in %s"), BASE_CONF_DIR, share_dir); #if GTK_MAJOR_VERSION == 1 dialog = gtk_dialog_new (); gtk_window_set_title (GTK_WINDOW (dialog), _("About gFTP")); gtk_container_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->action_area), 5); gtk_box_set_homogeneous (GTK_BOX (GTK_DIALOG (dialog)->action_area), TRUE); #else dialog = gtk_dialog_new_with_buttons (_("About gFTP"), NULL, 0, GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, NULL); #endif gtk_window_set_wmclass (GTK_WINDOW(dialog), "about", "gFTP"); gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE); gtk_container_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), 10); gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 5); gtk_widget_realize (dialog); if (gftp_icon != NULL) { gdk_window_set_icon (dialog->window, NULL, gftp_icon->pixmap, gftp_icon->bitmap); gdk_window_set_icon_name (dialog->window, gftp_version); } notebook = gtk_notebook_new (); gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), notebook, TRUE, TRUE, 0); gtk_widget_show (notebook); box = gtk_vbox_new (TRUE, 5); gtk_container_border_width (GTK_CONTAINER (box), 10); gtk_widget_show (box); tempwid = toolbar_pixmap (dialog, "gftp-logo.xpm"); gtk_box_pack_start (GTK_BOX (box), tempwid, FALSE, FALSE, 0); gtk_widget_show (tempwid); tempstr = g_strdup_printf (_("%s\nCopyright (C) 1998-2007 Brian Masney <*****@*****.**>\nOfficial Homepage: http://www.gftp.org/\n"), gftp_version); str = _("Translated by"); if (strcmp (str, "Translated by") != 0) { tempstr = g_realloc (tempstr, (gulong) (strlen (tempstr) + strlen (str) + 1)); strcat (tempstr, str); } tempwid = gtk_label_new (tempstr); g_free (tempstr); gtk_box_pack_start (GTK_BOX (box), tempwid, FALSE, FALSE, 0); gtk_widget_show (tempwid); label = gtk_label_new (_("About")); gtk_widget_show (label); gtk_notebook_append_page (GTK_NOTEBOOK (notebook), box, label); box = gtk_vbox_new (FALSE, 5); gtk_container_border_width (GTK_CONTAINER (box), 10); gtk_widget_show (box); tempwid = gtk_table_new (1, 2, FALSE); gtk_box_pack_start (GTK_BOX (box), tempwid, TRUE, TRUE, 0); gtk_widget_show (tempwid); #if GTK_MAJOR_VERSION == 1 view = gtk_text_new (NULL, NULL); gtk_text_set_editable (GTK_TEXT (view), FALSE); gtk_text_set_word_wrap (GTK_TEXT (view), TRUE); gtk_table_attach (GTK_TABLE (tempwid), view, 0, 1, 0, 1, GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 0); gtk_widget_show (view); vscroll = gtk_vscrollbar_new (GTK_TEXT (view)->vadj); gtk_table_attach (GTK_TABLE (tempwid), vscroll, 1, 2, 0, 1, GTK_FILL, GTK_EXPAND | GTK_FILL | GTK_SHRINK, 0, 0); gtk_widget_show (vscroll); #else view = gtk_text_view_new (); gtk_text_view_set_editable (GTK_TEXT_VIEW (view), FALSE); gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (view), FALSE); gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (view), GTK_WRAP_WORD); vscroll = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (vscroll), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_container_add (GTK_CONTAINER (vscroll), view); gtk_widget_show (view); gtk_table_attach (GTK_TABLE (tempwid), vscroll, 0, 1, 0, 1, GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 0); gtk_widget_show (vscroll); textbuf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)); #endif label = gtk_label_new (_("License Agreement")); gtk_widget_show (label); gtk_notebook_append_page (GTK_NOTEBOOK (notebook), box, label); #if GTK_MAJOR_VERSION == 1 tempwid = gtk_button_new_with_label (_(" Close ")); GTK_WIDGET_SET_FLAGS (tempwid, GTK_CAN_DEFAULT); gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->action_area), tempwid, FALSE, FALSE, 0); gtk_signal_connect_object (GTK_OBJECT (tempwid), "clicked", GTK_SIGNAL_FUNC (gtk_widget_destroy), GTK_OBJECT (dialog)); gtk_widget_grab_default (tempwid); gtk_widget_show (tempwid); #else g_signal_connect_swapped (GTK_OBJECT (dialog), "response", G_CALLBACK (gtk_widget_destroy), GTK_OBJECT (dialog)); #endif tempstr = g_strconcat ("/usr/share/common-licenses/GPL", NULL); if (access (tempstr, F_OK) != 0) { g_free (tempstr); temp1str = g_strconcat (share_dir, "/COPYING", NULL); tempstr = gftp_expand_path (NULL, temp1str); g_free (temp1str); if (access (tempstr, F_OK) != 0) { g_free (tempstr); tempstr = gftp_expand_path (NULL, BASE_CONF_DIR "/COPYING"); if (access (tempstr, F_OK) != 0) { #if GTK_MAJOR_VERSION == 1 gtk_text_insert (GTK_TEXT (view), NULL, NULL, NULL, no_license_agreement, -1); #else textlen = gtk_text_buffer_get_char_count (textbuf); gtk_text_buffer_get_iter_at_offset (textbuf, &iter, textlen); gtk_text_buffer_insert (textbuf, &iter, no_license_agreement, -1); #endif gtk_widget_show (dialog); return; } } } if ((fd = fopen (tempstr, "r")) == NULL) { #if GTK_MAJOR_VERSION == 1 gtk_text_insert (GTK_TEXT (view), NULL, NULL, NULL, no_license_agreement, -1); #else textlen = gtk_text_buffer_get_char_count (textbuf); gtk_text_buffer_get_iter_at_offset (textbuf, &iter, textlen); gtk_text_buffer_insert (textbuf, &iter, no_license_agreement, -1); #endif gtk_widget_show (dialog); g_free (tempstr); return; } g_free (tempstr); memset (buf, 0, sizeof (buf)); while ((len = fread (buf, 1, sizeof (buf) - 1, fd))) { buf[len] = '\0'; #if GTK_MAJOR_VERSION == 1 gtk_text_insert (GTK_TEXT (view), NULL, NULL, NULL, buf, -1); #else textlen = gtk_text_buffer_get_char_count (textbuf); gtk_text_buffer_get_iter_at_offset (textbuf, &iter, textlen); gtk_text_buffer_insert (textbuf, &iter, buf, -1); #endif } fclose (fd); gtk_widget_show (dialog); g_free (no_license_agreement); gftp_free_pixmap ("gftp-logo.xpm"); }
void view_file (char *filename, int fd, unsigned int viewedit, unsigned int del_file, unsigned int start_pos, unsigned int dontupload, char *remote_filename, gftp_window_data * wdata) { GtkWidget * dialog, * view, * table, * tempwid; char buf[8192], *view_program, *edit_program; gftp_config_list_vars * tmplistvar; gftp_file_extensions * tempext; gftp_viewedit_data * newproc; GtkAdjustment * vadj; GList * templist; size_t stlen; int doclose; ssize_t n; char * non_utf8; GtkTextBuffer * textbuf; GtkTextIter iter; doclose = 1; stlen = strlen (filename); gftp_lookup_global_option ("ext", &tmplistvar); for (templist = tmplistvar->list; templist != NULL; templist = templist->next) { tempext = templist->data; if (stlen >= tempext->stlen && strcmp (&filename[stlen - tempext->stlen], tempext->ext) == 0) { if (*tempext->view_program == '\0') break; ftp_log (gftp_logging_misc, NULL, _("Opening %s with %s\n"), filename, tempext->view_program); fork_process (tempext->view_program, filename, fd, remote_filename, viewedit, del_file, dontupload, wdata); return; } } if (wdata != NULL) { gftp_lookup_request_option (wdata->request, "view_program", &view_program); gftp_lookup_request_option (wdata->request, "edit_program", &edit_program); if ((non_utf8 = gftp_filename_from_utf8 (wdata->request, filename, NULL)) == NULL) /* freeme later! */ non_utf8 = filename; } else { gftp_lookup_global_option ("view_program", &view_program); gftp_lookup_global_option ("edit_program", &edit_program); non_utf8 = filename; } if (viewedit && *view_program != '\0') { /* Open the file with the default file viewer */ fork_process (view_program, filename, fd, remote_filename, viewedit, del_file, dontupload, wdata); if (non_utf8 != filename && non_utf8) g_free (non_utf8); return; } else if (!viewedit && *edit_program != '\0') { /* Open the file with the default file editor */ newproc = fork_process (edit_program, filename, fd, remote_filename, viewedit, del_file, dontupload, wdata); stat (non_utf8, &newproc->st); if (non_utf8 != filename && non_utf8) g_free (non_utf8); return; } ftp_log (gftp_logging_misc, NULL, _("Viewing file %s\n"), filename); if (fd == 0) { if ((fd = open (non_utf8, O_RDONLY)) < 0) { ftp_log (gftp_logging_error, NULL, _("View: Cannot open file %s: %s\n"), non_utf8, g_strerror (errno)); if (non_utf8 != filename && non_utf8) g_free (non_utf8); return; } doclose = 1; } else { lseek (fd, 0, SEEK_SET); doclose = 0; } if (del_file) { if (unlink (non_utf8) == 0) ftp_log (gftp_logging_misc, NULL, _("Successfully removed %s\n"), filename); else ftp_log (gftp_logging_error, NULL, _("Error: Could not remove file %s: %s\n"), filename, g_strerror (errno)); } if (non_utf8 != filename && non_utf8) g_free (non_utf8); dialog = gtk_dialog_new_with_buttons (filename, NULL, 0, GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, NULL); gtk_window_set_wmclass (GTK_WINDOW(dialog), "fileview", "gFTP"); gtk_container_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), 5); gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 5); gtk_widget_realize (dialog); if (gftp_icon != NULL) { gdk_window_set_icon (dialog->window, NULL, gftp_icon->pixmap, gftp_icon->bitmap); gdk_window_set_icon_name (dialog->window, gftp_version); } table = gtk_table_new (1, 2, FALSE); gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), table, TRUE, TRUE, 0); view = gtk_text_view_new (); gtk_text_view_set_editable (GTK_TEXT_VIEW (view), FALSE); gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (view), FALSE); gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (view), GTK_WRAP_WORD); tempwid = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (tempwid), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_container_add (GTK_CONTAINER (tempwid), view); gtk_widget_show (view); gtk_table_attach (GTK_TABLE (table), tempwid, 0, 1, 0, 1, GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 0); gtk_widget_show (tempwid); vadj = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (tempwid)); gtk_widget_set_size_request (table, 500, 400); gtk_widget_show (table); g_signal_connect_swapped (GTK_OBJECT (dialog), "response", G_CALLBACK (gtk_widget_destroy), GTK_OBJECT (dialog)); buf[sizeof (buf) - 1] = '\0'; while ((n = read (fd, buf, sizeof (buf) - 1)) > 0) { buf[n] = '\0'; textbuf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)); gtk_text_buffer_get_iter_at_offset (textbuf, &iter, -1); gtk_text_buffer_insert (textbuf, &iter, buf, -1); } if (doclose) close (fd); gtk_widget_show (dialog); if (!start_pos) gtk_adjustment_set_value (vadj, vadj->upper); }
void create_loglist(void) { GtkWidget *mvb,*sw,*dhb,*dhw[30]; GdkBitmap *mask; GdkPixmap *myicon; GtkStyle *style; GList *pt; int i; applet=gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_default_size(GTK_WINDOW(applet),780,510); gtk_window_set_title (GTK_WINDOW (applet), "YAWMPPP Connection Log"); gtk_window_set_wmclass(GTK_WINDOW(applet),"yawmppp","log"); gtk_container_set_border_width(GTK_CONTAINER(applet),4); gtk_widget_show (applet); style=gtk_widget_get_style(applet); myicon = gdk_pixmap_create_from_xpm_d (applet->window, &mask, &style->bg[GTK_STATE_NORMAL], (gchar **) stepphone_xpm); gdk_window_set_icon (applet->window, NULL, myicon, mask); gdk_window_set_icon_name(applet->window,"The Log"); mvb=gtk_vbox_new(FALSE,0); gtk_container_add(GTK_CONTAINER(applet),mvb); dhb=gtk_hbox_new(FALSE,0); gtk_box_pack_start(GTK_BOX(mvb),dhb,FALSE,TRUE,0); /* data */ dhw[0]=gtk_label_new("Show summary for:"); gtk_box_pack_start(GTK_BOX(dhb),dhw[0],FALSE,FALSE,4); dhw[1]=gtk_option_menu_new(); gtk_box_pack_start(GTK_BOX(dhb),dhw[1],FALSE,FALSE,2); dhw[2]=gtk_menu_new(); for(i=0;i<10;i++) { dhw[3]=gtk_menu_item_new_with_label(resumeo[i]); gtk_signal_connect(GTK_OBJECT(dhw[3]),"activate", GTK_SIGNAL_FUNC(time_menu),&nsrc[i]); gtk_menu_append(GTK_MENU(dhw[2]),dhw[3]); gtk_widget_show(dhw[3]); } gtk_option_menu_set_menu(GTK_OPTION_MENU(dhw[1]),dhw[2]); dhw[12]=gtk_label_new("include entries from"); gtk_box_pack_start(GTK_BOX(dhb),dhw[12],FALSE,FALSE,4); dhw[13]=gtk_option_menu_new(); gtk_box_pack_start(GTK_BOX(dhb),dhw[13],FALSE,FALSE,2); dhw[14]=gtk_menu_new(); for(i=0,pt=isps;pt!=NULL;pt=g_list_next(pt),i++) { dhw[3]=gtk_menu_item_new_with_label((char *)(pt->data)); gtk_signal_connect(GTK_OBJECT(dhw[3]),"activate", GTK_SIGNAL_FUNC(isp_menu),&nsrc[i]); gtk_menu_append(GTK_MENU(dhw[14]),dhw[3]); gtk_widget_show(dhw[3]); } gtk_option_menu_set_menu(GTK_OPTION_MENU(dhw[13]),dhw[14]); dhw[15]=gtk_label_new("include connections as"); gtk_box_pack_start(GTK_BOX(dhb),dhw[15],FALSE,FALSE,4); dhw[16]=gtk_option_menu_new(); gtk_box_pack_start(GTK_BOX(dhb),dhw[16],FALSE,FALSE,2); dhw[17]=gtk_menu_new(); for(i=0,pt=users;pt!=NULL;pt=g_list_next(pt),i++) { dhw[3]=gtk_menu_item_new_with_label((char *)(pt->data)); gtk_signal_connect(GTK_OBJECT(dhw[3]),"activate", GTK_SIGNAL_FUNC(user_menu),&nsrc[i]); gtk_menu_append(GTK_MENU(dhw[17]),dhw[3]); gtk_widget_show(dhw[3]); } gtk_option_menu_set_menu(GTK_OPTION_MENU(dhw[16]),dhw[17]); dhw[5]=gtk_hseparator_new(); gtk_box_pack_start(GTK_BOX(mvb),dhw[5],FALSE,FALSE,3); dhw[3]=gtk_hbox_new(FALSE,4); gtk_box_pack_start(GTK_BOX(mvb),dhw[3],FALSE,TRUE,3); dhw[4]=lresume[0]=gtk_label_new("\n\n\n\n\n"); dhw[6]=lresume[1]=gtk_label_new("\n\n\n\n\n"); for(i=0;i<2;i++) gtk_label_set_justify(GTK_LABEL(lresume[i]),GTK_JUSTIFY_LEFT); gtk_box_pack_start(GTK_BOX(dhw[3]),dhw[4],FALSE,TRUE,4); gtk_box_pack_start(GTK_BOX(dhw[3]),dhw[6],FALSE,TRUE,4); hgraph=dhw[7]=gtk_drawing_area_new(); gtk_drawing_area_size(GTK_DRAWING_AREA(dhw[7]),24*9+2,120); gtk_widget_set_events(dhw[7],GDK_EXPOSURE_MASK); gtk_box_pack_start(GTK_BOX(dhw[3]),dhw[7],FALSE,FALSE,4); wgraph=dhw[8]=gtk_drawing_area_new(); gtk_drawing_area_size(GTK_DRAWING_AREA(dhw[8]),7*20+2,120); gtk_widget_set_events(dhw[8],GDK_EXPOSURE_MASK); gtk_box_pack_start(GTK_BOX(dhw[3]),dhw[8],FALSE,FALSE,4); dhw[11]=gtk_hseparator_new(); gtk_box_pack_start(GTK_BOX(mvb),dhw[11],FALSE,FALSE,4); dhw[9]=gtk_hbox_new(FALSE,2); dhw[10]=gtk_label_new("Raw log listing (unfiltered):"); gtk_box_pack_start(GTK_BOX(mvb),dhw[9],FALSE,FALSE,4); gtk_box_pack_start(GTK_BOX(dhw[9]),dhw[10],FALSE,FALSE,2); /* list */ sw=gtk_scrolled_window_new(NULL,NULL); gtk_box_pack_start(GTK_BOX(mvb),sw,TRUE,TRUE,4); gtk_widget_show(sw); gtk_container_set_border_width(GTK_CONTAINER(sw),0); loglist=gtk_clist_new(8); gtk_clist_set_shadow_type(GTK_CLIST(loglist),GTK_SHADOW_IN); gtk_clist_set_selection_mode(GTK_CLIST(loglist),GTK_SELECTION_SINGLE); for(i=0;i<8;i++) { gtk_clist_set_column_title(GTK_CLIST(loglist),i,titles[i]); gtk_clist_set_column_width(GTK_CLIST(loglist),i,colsize[i]); } gtk_clist_column_titles_passive(GTK_CLIST(loglist)); gtk_clist_column_titles_show(GTK_CLIST(loglist)); gtk_clist_set_row_height(GTK_CLIST(loglist),16); gtk_clist_set_column_auto_resize(GTK_CLIST(loglist),1,FALSE); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); gtk_container_add(GTK_CONTAINER(sw),loglist); gtk_widget_show(loglist); /* bottom */ dhw[18]=gtk_hseparator_new(); gtk_box_pack_start(GTK_BOX(mvb),dhw[18],FALSE,FALSE,4); dhw[19]=gtk_table_new(1,6,TRUE); dhw[21]=gtk_button_new_with_label(" About... "); dhw[22]=gtk_button_new_with_label(" Close "); dhw[23]=gtk_hbox_new(TRUE,6); gtk_box_pack_start(GTK_BOX(mvb),dhw[19],FALSE,FALSE,4); gtk_table_attach_defaults(GTK_TABLE(dhw[19]),dhw[23],4,6,0,1); gtk_box_pack_start(GTK_BOX(dhw[23]),dhw[21],FALSE,TRUE,4); gtk_box_pack_start(GTK_BOX(dhw[23]),dhw[22],FALSE,TRUE,4); for(i=0;i<24;i++) if (i!=20) gtk_widget_show(dhw[i]); gtk_widget_show(dhb); gtk_widget_show(mvb); iconmap[0] = gdk_pixmap_create_from_xpm_d (applet->window, &maskmap[0], &style->bg[GTK_STATE_NORMAL], (gchar **) status_ok_xpm); iconmap[1] = gdk_pixmap_create_from_xpm_d (applet->window, &maskmap[1], &style->bg[GTK_STATE_NORMAL], (gchar **) status_error_xpm); iconmap[2] = gdk_pixmap_create_from_xpm_d (applet->window, &maskmap[2], &style->bg[GTK_STATE_NORMAL], (gchar **) status_crash_xpm); /* signal plumbing */ gtk_signal_connect (GTK_OBJECT (applet), "delete_event", GTK_SIGNAL_FUNC (applet_kill), NULL); gtk_signal_connect (GTK_OBJECT (applet), "destroy", GTK_SIGNAL_FUNC (applet_destroy), NULL); gtk_signal_connect (GTK_OBJECT (hgraph), "expose_event", GTK_SIGNAL_FUNC (hgra_expose), NULL); gtk_signal_connect (GTK_OBJECT (hgraph), "configure_event", GTK_SIGNAL_FUNC (hgra_configure), NULL); gtk_signal_connect (GTK_OBJECT (wgraph), "expose_event", GTK_SIGNAL_FUNC (wgra_expose), NULL); gtk_signal_connect (GTK_OBJECT (wgraph), "configure_event", GTK_SIGNAL_FUNC (wgra_configure), NULL); gtk_signal_connect (GTK_OBJECT (dhw[21]), "clicked", GTK_SIGNAL_FUNC (applet_about), (gpointer)GTK_WINDOW(applet)); gtk_signal_connect (GTK_OBJECT (dhw[22]), "clicked", GTK_SIGNAL_FUNC (applet_destroy), NULL); }
void chmod_dialog (gpointer data) { GtkWidget *tempwid, *dialog, *hbox, *vbox; GList * templist, * filelist; gftp_window_data * wdata; gftp_file * tempfle; int num; wdata = data; if (!check_status (_("Chmod"), wdata, gftpui_common_use_threads (wdata->request), 0, 1, wdata->request->chmod != NULL)) return; #if GTK_MAJOR_VERSION == 1 dialog = gtk_dialog_new (); gtk_window_set_title (GTK_WINDOW (dialog), _("Chmod")); gtk_container_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->action_area), 5); gtk_box_set_homogeneous (GTK_BOX (GTK_DIALOG (dialog)->action_area), TRUE); #else dialog = gtk_dialog_new_with_buttons (_("Chmod"), NULL, 0, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); #endif gtk_window_set_wmclass (GTK_WINDOW(dialog), "Chmod", "gFTP"); gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE); gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 5); gtk_container_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), 10); gtk_widget_realize (dialog); if (gftp_icon != NULL) { gdk_window_set_icon (dialog->window, NULL, gftp_icon->pixmap, gftp_icon->bitmap); gdk_window_set_icon_name (dialog->window, gftp_version); } tempwid = gtk_label_new (_("You can now adjust the attributes of your file(s)\nNote: Not all ftp servers support the chmod feature")); gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), tempwid, FALSE, FALSE, 0); gtk_widget_show (tempwid); hbox = gtk_hbox_new (TRUE, 5); gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox, FALSE, FALSE, 0); gtk_widget_show (hbox); tempwid = gtk_frame_new (_("Special")); gtk_box_pack_start (GTK_BOX (hbox), tempwid, FALSE, FALSE, 0); gtk_widget_show (tempwid); vbox = gtk_vbox_new (TRUE, 5); gtk_container_add (GTK_CONTAINER (tempwid), vbox); gtk_widget_show (vbox); suid = gtk_check_button_new_with_label (_("SUID")); gtk_box_pack_start (GTK_BOX (vbox), suid, FALSE, FALSE, 0); gtk_widget_show (suid); sgid = gtk_check_button_new_with_label (_("SGID")); gtk_box_pack_start (GTK_BOX (vbox), sgid, FALSE, FALSE, 0); gtk_widget_show (sgid); sticky = gtk_check_button_new_with_label (_("Sticky")); gtk_box_pack_start (GTK_BOX (vbox), sticky, FALSE, FALSE, 0); gtk_widget_show (sticky); tempwid = gtk_frame_new (_("User")); gtk_box_pack_start (GTK_BOX (hbox), tempwid, FALSE, FALSE, 0); gtk_widget_show (tempwid); vbox = gtk_vbox_new (TRUE, 5); gtk_container_add (GTK_CONTAINER (tempwid), vbox); gtk_widget_show (vbox); ur = gtk_check_button_new_with_label (_("Read")); gtk_box_pack_start (GTK_BOX (vbox), ur, FALSE, FALSE, 0); gtk_widget_show (ur); uw = gtk_check_button_new_with_label (_("Write")); gtk_box_pack_start (GTK_BOX (vbox), uw, FALSE, FALSE, 0); gtk_widget_show (uw); ux = gtk_check_button_new_with_label (_("Execute")); gtk_box_pack_start (GTK_BOX (vbox), ux, FALSE, FALSE, 0); gtk_widget_show (ux); tempwid = gtk_frame_new (_("Group")); gtk_box_pack_start (GTK_BOX (hbox), tempwid, FALSE, FALSE, 0); gtk_widget_show (tempwid); vbox = gtk_vbox_new (TRUE, 5); gtk_container_add (GTK_CONTAINER (tempwid), vbox); gtk_widget_show (vbox); gr = gtk_check_button_new_with_label (_("Read")); gtk_box_pack_start (GTK_BOX (vbox), gr, FALSE, FALSE, 0); gtk_widget_show (gr); gw = gtk_check_button_new_with_label (_("Write")); gtk_box_pack_start (GTK_BOX (vbox), gw, FALSE, FALSE, 0); gtk_widget_show (gw); gx = gtk_check_button_new_with_label (_("Execute")); gtk_box_pack_start (GTK_BOX (vbox), gx, FALSE, FALSE, 0); gtk_widget_show (gx); tempwid = gtk_frame_new (_("Other")); gtk_box_pack_start (GTK_BOX (hbox), tempwid, FALSE, FALSE, 0); gtk_widget_show (tempwid); vbox = gtk_vbox_new (TRUE, 5); gtk_container_add (GTK_CONTAINER (tempwid), vbox); gtk_widget_show (vbox); or = gtk_check_button_new_with_label (_("Read")); gtk_box_pack_start (GTK_BOX (vbox), or, FALSE, FALSE, 0); gtk_widget_show (or); ow = gtk_check_button_new_with_label (_("Write")); gtk_box_pack_start (GTK_BOX (vbox), ow, FALSE, FALSE, 0); gtk_widget_show (ow); ox = gtk_check_button_new_with_label (_("Execute")); gtk_box_pack_start (GTK_BOX (vbox), ox, FALSE, FALSE, 0); gtk_widget_show (ox); #if GTK_MAJOR_VERSION == 1 tempwid = gtk_button_new_with_label (_("OK")); GTK_WIDGET_SET_FLAGS (tempwid, GTK_CAN_DEFAULT); gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->action_area), tempwid, TRUE, TRUE, 0); gtk_signal_connect (GTK_OBJECT (tempwid), "clicked", GTK_SIGNAL_FUNC (dochmod), (gpointer) wdata); gtk_signal_connect_object (GTK_OBJECT (tempwid), "clicked", GTK_SIGNAL_FUNC (gtk_widget_destroy), GTK_OBJECT (dialog)); gtk_widget_grab_default (tempwid); gtk_widget_show (tempwid); tempwid = gtk_button_new_with_label (_(" Cancel ")); GTK_WIDGET_SET_FLAGS (tempwid, GTK_CAN_DEFAULT); gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->action_area), tempwid, TRUE, TRUE, 0); gtk_signal_connect_object (GTK_OBJECT (tempwid), "clicked", GTK_SIGNAL_FUNC (gtk_widget_destroy), GTK_OBJECT (dialog)); gtk_widget_show (tempwid); #else g_signal_connect (GTK_OBJECT (dialog), "response", G_CALLBACK (chmod_action), wdata); #endif if (IS_ONE_SELECTED (wdata)) { filelist = wdata->files; templist = gftp_gtk_get_list_selection (wdata); num = 0; templist = get_next_selection (templist, &filelist, &num); tempfle = filelist->data; gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (suid), tempfle->st_mode & S_ISUID); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ur), tempfle->st_mode & S_IRUSR); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (uw), tempfle->st_mode & S_IWUSR); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ux), tempfle->st_mode & S_IXUSR); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (sgid), tempfle->st_mode & S_ISGID); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gr), tempfle->st_mode & S_IRGRP); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gw), tempfle->st_mode & S_IWGRP); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gx), tempfle->st_mode & S_IXGRP); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (sticky), tempfle->st_mode & S_ISVTX); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (or), tempfle->st_mode & S_IROTH); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ow), tempfle->st_mode & S_IWOTH); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ox), tempfle->st_mode & S_IXOTH); } gtk_widget_show (dialog); }