Problem
I create a GMenuModel and set is as application app menu.
However, the items in the app are disabled.
Q: How do I enable them?
Code
GMenuModel * createMenu(){
GMenu * menu = g_menu_new();
g_menu_append(menu, "Item1", "item1_action1");
return (GMenuModel*)menu;
}
...
GMenuModel * menu = createMenu(GTK_APPLICATION(app));
gtk_application_set_app_menu(GTK_APPLICATION(app), (GMenuModel*)menu);
g_object_unref (menu);
GActionEntry actions[] = {
{"item1_action1", exampleAction, NULL, NULL, NULL}
};
g_action_map_add_action_entries(G_ACTION_MAP(app),actions, 1, NULL);
Your problem: The menu items are not connected to existing actions.
Your solution: Set the correct detailed_action when creating the menu item. (it is missing the prefix app.).
Code
GMenuModel * createMenu(){
GMenu * menu = g_menu_new();
g_menu_append(menu, "Item1", "app.item1_action1");
return (GMenuModel*)menu;
}
How to figure this out?
Run your app with the inspector: GTK_DEBUG=interactive ./a.out
Double click any item to open its properties.
Choose Actions from the combo box. That is, the ones you register with g_action_map_add_action_entries!
See the column Prefix showing app.
g_action_map_add_action_entries(G_ACTION_MAP(app),...) registers actions for the app. Therefore it adds an app prefix to the action names.
So in your menu creation you need to use the full name (ie app.item1_action1) as detailed_action name.
Be aware of the Prefix column, that says app
Related
I am running Vaadin 8, and have a TreeGrid with a column setup with combo box for editing. Unfortunately when I click on a combo on a row it momentarily opens and closes the dropdown, pretty much not allowing me to see the combo choices, however I can still type text in the combo and only then the dropdown appears (combo has few sample values in it). I noticed when my session expires (and the server is not connected) I am able to get the dropdown to open.
Here is my code snippet adding such a column:
tg.addComponentColumn( r -> {
ComboBox<String> labelsCb = new ComboBox<>();
labelsCb.setNewItemProvider( new NewItemProvider<String>() {
#Override
public Optional<String> apply( String t ) {
return Optional.of( t );
}
} );
labelsCb.setDataProvider( labelsDp );
labelsCb.setHeight( LABEL_COMBO_HEIGHT + "px" );
labelsCb.setWidth( LABEL_COMBO_WIDTH_PX + "px" );
labelsCb.addSelectionListener( event -> {
r.setLabel( event.getValue() );
});
return labelsCb;
} ).setCaption( LABEL ).setWidth( LABEL_COMBO_WIDTH_PX * 1.40 );
Found the reason - my combo column was interfering with TreeGrid's expander column (first on the left) - once I made it second column it started working. It is a bug with TreeGrid I believe, but this one is a decent workaround.
I would like to do customization as below in Eclipse Che.
Please share the reference information such as sample etc.
Addition of original menu
Would like to add items in right-click menu of the project and header menu of Eclipse Che.
Call of extended-plugin processing from added menu
From the menu added in 1., would like to call the processing of plugin created originally.
Would like to apply the plugin extended in 2. in Eclipse Che.
Here is an example for adding toolbar, you can add your menu using the same example.
Please look into this page https://www.eclipse.org/che/docs/assemblies/sdk-actions/index.html
#Extension(title = "Sample Actions Extension", version = "1.0.0")
public class SampleActionsExtensions {
#Inject
public SampleActionsExtensions(HelloWorldAction helloWorldAction, ActionManager actionManager) {
actionManager.registerAction("helloWorldAction", helloWorldAction);
actionManager.registerAction("helloWorldActionWithIcon", helloWorldActionWithIcon);
/...
DefaultActionGroup sampleGroup = new DefaultActionGroup("Sample actions", true, actionManager);
sampleGroup.add(helloWorldAction);
// add sample group after help menu entry
DefaultActionGroup mainMenu = (DefaultActionGroup)actionManager.getAction(GROUP_MAIN_MENU);
mainMenu.add(sampleGroup);
// add the sample group to the beginning of the toolbar as well
DefaultActionGroup toolbar = (DefaultActionGroup)actionManager.getAction(IdeActions.GROUP_MAIN_TOOLBAR);
toolbar.add(helloWorldActionWithIcon);
/...
}
}
We are new to DNN and we plan to add a product module that is in charge of adding, editing, deleting, listing, and showing the details of the products.
We have written a UserControl named ProductsList.ascx, which has AddProducts.ascx and ShowPrdoctDetail.ascx defined in it, using Host => Extensions => ProductsList => Module Definition => Add Module Control.
In admin mode,we have created a page and dragged the module in it, so that the admin of the site can add, edit, delete, and see the details of each product.
Also there is a slideshow in the homepage that shows the latest products.In addition, the products are shown in the menu.
Now, we want to redirect user to the product detail page (ShowPrdoctDetail.ascx in our case) whenever he/she clicked the product shown in slideshow or in menu.
We are aware of Globals.NavigateUrl() method, but it needs tabid and mid to redirect to a specific page and module and in DNN every added page by admin will get different tabid and mid.
Since in DNN, admin can create many pages and add this module to them, we have no idea that what tabid and mid we should pass to Globals.NavigateUrl() in order to navigate user to product details page (ShowPrdoctDetail.ascx) when user clicked on a specific product in menu or slideshow.
Any kind of help is highly appreciated.
Try save current tabid to DB when adding product detail module into page. And with ProductId, you can grab tabid of product detail, and use it to redirect to correct page.
The way I would tackle this is to create another Module Definition for the details module and give it a Friendly name like "Product Details" and add the ShowProductDetail.ascx module control as the default view of this new module definition.
Then you can drag that new module onto a page for your product details page.
In your main Product Admin module, you can create a setting view with a dropdown list that contains a list of all tabs (pages) that the "Product Details" module on.
You can use the following method to get the list of tabs in the portal that has an instance of the module:
private List<TabInfo> GetAllModuleTabsbyModuleName(string friendlyName)
{
List<TabInfo> results = new List<TabInfo>();
Dictionary<int, int> dups = new Dictionary<int, int>();
ModuleController mc = new ModuleController();
ArrayList oModules = mc.GetModulesByDefinition(base.PortalId, friendlyName);
TabController tc = new TabController();
TabCollection oTabs = tc.GetTabsByPortal(base.PortalId);
foreach (ModuleInfo oModule in oModules)
{
foreach (KeyValuePair<int, TabInfo> oTab in oTabs)
{
if (oTab.Key == oModule.TabID && !dups.ContainsKey(oModule.TabID))
{
results.Add(oTab.Value);
dups.Add(oModule.TabID, oModule.TabID);
}
}
}
return results;
}
You can bind that to the dropdown list options and an administrator could select the page that will be redirected when a product is clicked on the main module.
ddlProdDetailsTab.DataSource = GetAllModuleTabsbyModuleName("Product Details");
ddlProdDetailsTab.DataValueField = "TabID";
ddlProdDetailsTab.DataTextField = "TabName";
ddlProdDetailsTab.DataBind();
So from the settings, you know the TabId you want to redirect to, then you need the moduleId and you can create the redirect using NavigateUrl().
var pdTab = TabController.Instance.GetTab(Convert.ToInt32(Settings["ProductDetailTabId"]), PortalId);
var pdModule = pdTab.Modules.Cast<ModuleInfo>().FirstOrDefault(m => m.ModuleName == "Product Details");
var productLink = Globals.NavigateURL(pdTab.TabId, "", "mid=" + pdModule.ModuleId, "productId=" + productId);
I am using Vaadin 7.5.5 and Viritin 1.35. I have implemented a LazyComboBox that is backed by a Spring Data JPA service call and repository.
My basic setup for the LazyComboBox is:
initList(
Site.class,
new FilterablePagingProvider() {
#Override
public List findEntities(int index, String name) {
return sitesService.findByName(name);
}
},
new FilterableCountProvider() {
#Override
public int size(String name) {
return sitesService.countByName(name);
}
},
PAGE_SIZE
);
This works great when I am typing in the combo box.
If I pick an item from the first page (page 0) I can then leave the combo box, come back to it, and click the drop down arrow again and the previously selected item is still selected.
However, if I choose an item from any page other than 0, then clicking the drop down arrow causes the selected item to become null and the user has to find the original item again.
I can post the details of the service and repository if needed but it isn't anything more complicated than a select * from table where name like '%' + name + '%'.
How do I keep the selected value in the combo box no matter what page was chosen?
Thank you.
I think you should call setNullSelectionAllowed(false); on this combo box.
Also, a solution to keep selected value after navigation can be to store it in a session value, then you'll be able to retreive it wherever you are. See Session wiki page
I am a bit stuck with this so it would be great if you could help.
I am using Drupal 7 and Ckeditor 4.3. I am developing a site which has fmath equation editor integrated.
I have disabled the image button, as I don't want end users being able to upload their own images. On the other hand, users can use fMath to insert equations. The way fMath handles equation insertion is by inserting a img tag.
When users double click this image or when they right click over the image, they access the image properties dialog, where they can change source url of the image and few other things. On the url input text, they could change the source of the image so that they could insert their own images on the page, which is something I don't want.
The have been working with two different unsuccessful approaches until now trying to solve this problem:
Removing elements from the dialog, as the URL input text on the dialog (and the alt text as well).
Trying to disable the dialog itself.
I'd like to use a custom plugin to accomplish the desired behavior as I have different CKeditor profiles in Drupal.
I haven't been successful. Do you know how could I handle this undesirable behavior?
Ok, I ended up with something like this in the plugin.js file:
CKEDITOR.plugins.add( 'custom_doubleclick',
{
init: function( editor )
{
// First part, dialogDefinition allow us to remove the
// "Link" and "Advanced" tabs on the dialog
CKEDITOR.on( 'dialogDefinition', function( ev ) {
var dialogName = ev.data.name;
var dialogDefinition = ev.data.definition;
if ( dialogName == 'image' ) {
dialogDefinition.removeContents( 'Link' );
dialogDefinition.removeContents( 'advanced' );
}
});
// Second part, it disables the textUrl and txtAlt input text boxes
editor.on( 'dialogShow', function( ev ) {
var dialog = ev.data;
var dialogName = dialog.getName();
if ( dialogName == 'image' ) {
//var dialog = CKEDITOR.dialog.getCurrent();
// Get a reference to the Link Info tab.
console.log(dialog)
dialog.getContentElement( 'info','txtUrl' ).disable();
dialog.getContentElement( 'info','txtAlt' ).disable();
}
});
}
});
As you can see I didn't disable the dialog itself, but the non useful elements. I hope this can help to someone else.