예제 #1
0
/* callback function for the OK button */
static void
DialogOKClicked (GtkButton *button, gpointer data)
{
    PluginInstance* This = (PluginInstance*) data;
    GtkWidget* dialogWindow = gtk_object_get_data(GTK_OBJECT(button), DIALOGID);
    char *url;

    gtk_object_remove_data(GTK_OBJECT(button), DIALOGID);

    if (This->pluginsFileUrl != NULL)
    {
        /* Get the JavaScript command string */
        static const char buf[] =
            "javascript:netscape.softupdate.Trigger.StartSoftwareUpdate(\"%s\")";

        url = NPN_MemAlloc(strlen(This->pluginsFileUrl) + (sizeof(buf) - 2));
        if (url != NULL)
        {
            /* Insert the file URL into the JavaScript command */
            sprintf(url, buf, This->pluginsFileUrl);
            NPN_GetURL(This->instance, url, TARGET);
            NPN_MemFree(url);
        }
    }
    else
    {
        /* If necessary, get the default plug-ins page resource */
        char* address = This->pluginsPageUrl;
        if (address == NULL || *address == 0)
        {
            address = PLUGINSPAGE_URL;
        }

        url = NPN_MemAlloc(strlen(address) + 1 + strlen(This->type)+1);
        if (url != NULL)
        {
            NPN_PushPopupsEnabledState(This->instance, TRUE);
            /* Append the MIME type to the URL */
            sprintf(url, "%s?%s", address, This->type);
            if (strcmp (This->type, JVM_MINETYPE) == 0)
            {
                NPN_GetURL(This->instance, JVM_SMARTUPDATE_URL , TARGET);
            }
            else
            {
                NPN_GetURL(This->instance, url, TARGET);
            }
            NPN_MemFree(url);
            NPN_PopPopupsEnabledState(This->instance);
        }
    }
    destroyWidget(This);
}
예제 #2
0
void dt_clist_delete_data(struct formfill *form,
			  GtkWidget *hbox, 
			  GtkWidget *data_widget)
{
     GtkCList *clist = (GtkCList*) GTK_BIN(data_widget)->child;
     int i;

     gtk_clist_freeze(clist);
     gtk_clist_clear(clist);
     
     gtk_object_remove_data(GTK_OBJECT(data_widget), "data");
     gtk_widget_set_usize(hbox, -1, DT_CLIST_EMPTY_HEIGHT);

     for ( i = 0 ; i < 2 ; i ++ ) {
	  gtk_clist_set_column_width(clist, i, 
				     gtk_clist_optimal_column_width(clist, i));
     }
	  
     gtk_clist_thaw(clist);
}
예제 #3
0
void dt_clist_store_data(struct formfill *form, 
			 GtkWidget *hbox,
			 GtkWidget *data_widget,
			 const GByteArray *data)
{
     GtkCList *clist = (GtkCList*) GTK_BIN(data_widget)->child;
     int i;

     gtk_clist_freeze(clist);
     gtk_clist_clear(clist);

     gtk_object_remove_data(GTK_OBJECT(data_widget), "data"); 

     if(data) {
	  GByteArray *internal = g_byte_array_new();
	  g_byte_array_append(internal, data->data, data->len);

	  gtk_object_set_data_full(GTK_OBJECT(data_widget), "data", 
				   internal,
				   (GtkDestroyNotify) free_internal_data);
	  if (internal->len > 0) {
	       GQTypeDisplayClass* klass = g_type_class_ref(form->dt_handler);
	       if (DT_CLIST(klass)->fill_clist) {
		    DT_CLIST(klass)->fill_clist(form, hbox,
							   data_widget,
							   internal, 
							   GTK_WIDGET(clist));
	       }
	       g_type_class_unref(klass);
	  }

	  for ( i = 0 ; i < 2 ; i ++ ) {
	       gtk_clist_set_column_width(GTK_CLIST(clist), i, 
					  gtk_clist_optimal_column_width(clist, i));
	  }
     }
     gtk_clist_thaw(clist);
}